MessageDecode

Trait MessageDecode 

Source
pub trait MessageDecode {
    // Required method
    fn decode<R: PbRead>(
        &mut self,
        decoder: &mut PbDecoder<R>,
        len: usize,
    ) -> Result<(), DecodeError<R::Error>>;

    // Provided methods
    fn decode_from_bytes(
        &mut self,
        bytes: &[u8],
    ) -> Result<(), DecodeError<Infallible>> { ... }
    fn decode_len_delimited<R: PbRead>(
        &mut self,
        decoder: &mut PbDecoder<R>,
    ) -> Result<(), DecodeError<R::Error>> { ... }
}
Expand description

Protobuf message that can be decoded from the wire.

Implementations are auto-generated by micropb-gen.

Required Methods§

Source

fn decode<R: PbRead>( &mut self, decoder: &mut PbDecoder<R>, len: usize, ) -> Result<(), DecodeError<R::Error>>

Decode an instance of the message from the decoder and merge it into self.

Length of the message needs to be known beforehand.

Provided Methods§

Source

fn decode_from_bytes( &mut self, bytes: &[u8], ) -> Result<(), DecodeError<Infallible>>

Decode an instance of the message from the provided bytes

Source

fn decode_len_delimited<R: PbRead>( &mut self, decoder: &mut PbDecoder<R>, ) -> Result<(), DecodeError<R::Error>>

Decode an instance of the message from the decoder as a length-delimited record, starting with a length prefix.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<T: MessageDecode> MessageDecode for &mut T

Available on crate feature decode only.
Source§

fn decode<R: PbRead>( &mut self, decoder: &mut PbDecoder<R>, len: usize, ) -> Result<(), DecodeError<R::Error>>

Source§

fn decode_from_bytes( &mut self, bytes: &[u8], ) -> Result<(), DecodeError<Infallible>>

Source§

fn decode_len_delimited<R: PbRead>( &mut self, decoder: &mut PbDecoder<R>, ) -> Result<(), DecodeError<R::Error>>

Implementors§