Struct mesh_protobuf::message::ProtobufAny
source · pub struct ProtobufAny { /* private fields */ }
Expand description
A protobuf message and the associated protobuf type URL.
This has the encoding of google.protobuf.Any
.
Implementations§
source§impl ProtobufAny
impl ProtobufAny
sourcepub fn new<T: DescribedProtobuf>(data: T) -> Self
pub fn new<T: DescribedProtobuf>(data: T) -> Self
Encodes data
as a protobuf message.
sourcepub fn parse<T: DescribedProtobuf>(&self) -> Result<T, Error>
pub fn parse<T: DescribedProtobuf>(&self) -> Result<T, Error>
Decodes the protobuf message into T
.
Fails if this message is an encoding of a different type.
sourcepub fn is_message<T: DescribedProtobuf>(&self) -> bool
pub fn is_message<T: DescribedProtobuf>(&self) -> bool
Returns true
if this message is an encoding of T
.
Trait Implementations§
source§impl Debug for ProtobufAny
impl Debug for ProtobufAny
source§impl DefaultEncoding for ProtobufAny
impl DefaultEncoding for ProtobufAny
source§type Encoding = TableEncoder
type Encoding = TableEncoder
The encoding to use for the serialization. Read more
source§impl DescribeTable for ProtobufAny
impl DescribeTable for ProtobufAny
source§const DESCRIPTION: MessageDescription<'static> = _
const DESCRIPTION: MessageDescription<'static> = _
The protobuf message description for this type.
source§impl<'encoding, AnyR: 'static> StructDecodeMetadata<'encoding, AnyR> for ProtobufAny
impl<'encoding, AnyR: 'static> StructDecodeMetadata<'encoding, AnyR> for ProtobufAny
source§const DECODERS: &'static [ErasedDecoderEntry] = _
const DECODERS: &'static [ErasedDecoderEntry] = _
The list of decoder vtables.
source§impl<AnyR: 'static> StructEncodeMetadata<AnyR> for ProtobufAny
impl<AnyR: 'static> StructEncodeMetadata<AnyR> for ProtobufAny
source§const ENCODERS: &'static [ErasedEncoderEntry] = _
const ENCODERS: &'static [ErasedEncoderEntry] = _
The list of encoder vtables.
source§impl StructMetadata for ProtobufAny
impl StructMetadata for ProtobufAny
impl Downcast<ProtobufAny> for ProtobufAny
Auto Trait Implementations§
impl Freeze for ProtobufAny
impl RefUnwindSafe for ProtobufAny
impl Send for ProtobufAny
impl Sync for ProtobufAny
impl Unpin for ProtobufAny
impl UnwindSafe for ProtobufAny
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> DescribedProtobuf for T
impl<T> DescribedProtobuf for T
source§const DESCRIPTION: MessageDescription<'static> = const DESCRIPTION: MessageDescription<'static> =
<<T as DefaultEncoding>::Encoding as DescribeMessage::<T>>::DESCRIPTION;
const DESCRIPTION: MessageDescription<'static> = const DESCRIPTION: MessageDescription<'static> = <<T as DefaultEncoding>::Encoding as DescribeMessage::<T>>::DESCRIPTION;
The message description.
source§impl<T> Protobuf for Twhere
T: DefaultEncoding,
<T as DefaultEncoding>::Encoding: MessageEncode<T, NoResources> + for<'a> MessageDecode<'a, T, NoResources> + FieldEncode<T, NoResources> + for<'a> FieldDecode<'a, T, NoResources>,
impl<T> Protobuf for Twhere
T: DefaultEncoding,
<T as DefaultEncoding>::Encoding: MessageEncode<T, NoResources> + for<'a> MessageDecode<'a, T, NoResources> + FieldEncode<T, NoResources> + for<'a> FieldDecode<'a, T, NoResources>,
source§type Encoding = <T as DefaultEncoding>::Encoding
type Encoding = <T as DefaultEncoding>::Encoding
The default encoding for
Self
.