Decode

Trait Decode 

Source
pub trait Decode<'de> {
    type Value<'a>: Sized
       where Self: 'a,
             'de: 'a;

    // Required method
    fn decode_with_format<'a, R>(
        format: Format,
        reader: &'a mut R,
    ) -> Result<Self::Value<'a>, Error<R::Error>>
       where R: IoRead<'de>,
             'de: 'a;

    // Provided method
    fn decode<'a, R>(
        reader: &'a mut R,
    ) -> Result<Self::Value<'a>, Error<R::Error>>
       where R: IoRead<'de>,
             'de: 'a { ... }
}
Expand description

Decode a value from MessagePack.

Returned values may borrow from the reader’s buffer with lifetime 'a (bounded by 'de).

Required Associated Types§

Source

type Value<'a>: Sized where Self: 'a, 'de: 'a

The decoded value (may borrow for 'a).

Required Methods§

Source

fn decode_with_format<'a, R>( format: Format, reader: &'a mut R, ) -> Result<Self::Value<'a>, Error<R::Error>>
where R: IoRead<'de>, 'de: 'a,

Decode with a previously read Format.

Provided Methods§

Source

fn decode<'a, R>(reader: &'a mut R) -> Result<Self::Value<'a>, Error<R::Error>>
where R: IoRead<'de>, 'de: 'a,

Decode the next value.

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<'de, V> Decode<'de> for Option<V>
where V: Decode<'de>,

Source§

type Value<'a> = Option<<V as Decode<'de>>::Value<'a>> where Self: 'a, 'de: 'a

Source§

fn decode_with_format<'a, R>( format: Format, reader: &'a mut R, ) -> Result<Self::Value<'a>, Error<R::Error>>
where R: IoRead<'de>, 'de: 'a,

Implementors§

Source§

impl<'de> Decode<'de> for ReferenceDecoder

Source§

type Value<'a> = Reference<'de, 'a> where Self: 'a, 'de: 'a

Source§

impl<'de> Decode<'de> for ReferenceStrDecoder

Source§

type Value<'a> = ReferenceStr<'de, 'a> where Self: 'a, 'de: 'a

Source§

impl<'de, T> Decode<'de> for T
where T: DecodeBorrowed<'de> + 'de,

Source§

type Value<'a> = <T as DecodeBorrowed<'de>>::Value where Self: 'a, 'de: 'a