Skip to main content

DecodeBytes

Trait DecodeBytes 

Source
pub trait DecodeBytes<'de>: Sized {
    // Required method
    fn decode_bytes_with_format<R>(
        format: Format,
        reader: &mut R,
    ) -> Result<Self, Error<R::Error>>
       where R: IoRead<'de>;

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

Trait for decoding MessagePack binary data.

Used by the derive macro for #[msgpack(bytes)] fields. Implement this trait for types that can be decoded from a MessagePack bin format.

Required Methods§

Source

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

Decode binary data from the reader, given the initial format.

Provided Methods§

Source

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

Decode binary data from the reader.

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> DecodeBytes<'de> for &'de [u8]

Source§

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

Source§

impl<'de> DecodeBytes<'de> for Box<[u8]>

Available on crate feature alloc only.
Source§

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

Source§

impl<'de> DecodeBytes<'de> for Vec<u8>

Available on crate feature alloc only.
Source§

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

Source§

impl<'de, T> DecodeBytes<'de> for Option<T>
where T: DecodeBytes<'de>,

Source§

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

Source§

impl<'de, const N: usize> DecodeBytes<'de> for [u8; N]

Source§

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

Implementors§