Trait Decodable

Source
pub trait Decodable: Sized {
    type Error: Error;
    type Cond;

    // Required method
    fn decode_with<R: Read>(
        reader: &mut R,
        cond: Self::Cond,
    ) -> Result<Self, Self::Error>;

    // Provided method
    fn decode<R: Read>(reader: &mut R) -> Result<Self, Self::Error>
       where Self::Cond: Default { ... }
}
Expand description

Methods for decoding bytes to an Object according to MQTT specification

Required Associated Types§

Required Methods§

Source

fn decode_with<R: Read>( reader: &mut R, cond: Self::Cond, ) -> Result<Self, Self::Error>

Decodes object with additional data (or hints)

Provided Methods§

Source

fn decode<R: Read>(reader: &mut R) -> Result<Self, Self::Error>
where Self::Cond: Default,

Decodes object from 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 Decodable for ()

Source§

impl Decodable for String

Source§

impl Decodable for Vec<u8>

Implementors§