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

source

pub fn new<T: DescribedProtobuf>(data: T) -> Self

Encodes data as a protobuf message.

source

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.

source

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

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl DefaultEncoding for ProtobufAny

source§

type Encoding = TableEncoder

The encoding to use for the serialization. Read more
source§

impl DescribeTable for ProtobufAny

source§

const DESCRIPTION: MessageDescription<'static> = _

The protobuf message description for this type.
source§

impl<'encoding, AnyR: 'static> StructDecodeMetadata<'encoding, AnyR> for ProtobufAny

source§

const DECODERS: &'static [ErasedDecoderEntry] = _

The list of decoder vtables.
source§

impl<AnyR: 'static> StructEncodeMetadata<AnyR> for ProtobufAny

source§

const ENCODERS: &'static [ErasedEncoderEntry] = _

The list of encoder vtables.
source§

impl StructMetadata for ProtobufAny

source§

const NUMBERS: &'static [u32] = _

The field numbers for each field.
source§

const OFFSETS: &'static [usize] = _

The byte offset to each field within the struct.
source§

impl Downcast<ProtobufAny> for ProtobufAny

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> DescribedProtobuf for T

source§

const DESCRIPTION: MessageDescription<'static> = const DESCRIPTION: MessageDescription<'static> = <<T as DefaultEncoding>::Encoding as DescribeMessage::<T>>::DESCRIPTION;

The message description.
source§

const TYPE_URL: TypeUrl<'static> = _

The type URL for this message.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Protobuf for T

source§

type Encoding = <T as DefaultEncoding>::Encoding

The default encoding for Self.
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T, U> Upcast<U> for T
where U: Downcast<T>,