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§
Sourcefn decode_cfg(buf: impl Buf, cfg: &Self::Cfg) -> Result<Self, Error>
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.