Decode

Trait Decode 

Source
pub trait Decode: Read {
    // Provided method
    fn decode_cfg(buf: impl Buf, cfg: &Self::Cfg) -> Result<Self, Error> { ... }
}
Expand description

Trait combining Read with a check for remaining bytes.

Ensures that all bytes from the input buffer were consumed during decoding.

Provided Methods§

Source

fn decode_cfg(buf: impl Buf, cfg: &Self::Cfg) -> Result<Self, Error>

Decodes a value from buf using cfg, ensuring the entire buffer is consumed.

Returns Error if decoding fails via Read::read_cfg or if there are leftover bytes in buf after reading.

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.

Implementors§

Source§

impl<T: Read> Decode for T