pub trait MessageExt: Message {
    // Required method
    fn to_bytes(&self) -> Result<Vec<u8, Global>, EncodeError>;

    // Provided methods
    fn from_any(any: &Any) -> Result<Self, DecodeError>
       where Self: Default + Sized + TypeUrl { ... }
    fn to_any(&self) -> Result<Any, EncodeError>
       where Self: TypeUrl { ... }
}
Expand description

Extension trait for Message.

Required Methods§

fn to_bytes(&self) -> Result<Vec<u8, Global>, EncodeError>

Serialize this protobuf message as a byte vector.

Provided Methods§

fn from_any(any: &Any) -> Result<Self, DecodeError>where Self: Default + Sized + TypeUrl,

Parse this message proto from Any.

fn to_any(&self) -> Result<Any, EncodeError>where Self: TypeUrl,

Serialize this message proto as Any.

Implementors§

§

impl<M> MessageExt for Mwhere M: Message,