pub trait Decode: Sized {
// Required method
fn decode(buf: &mut &[u8]) -> Result<Self>;
// Provided method
fn decode_exact(buf: &mut &[u8], size: usize) -> Result<Self> { ... }
}Expand description
Decode an element from a buffer.
Required Methods§
Provided Methods§
Sourcefn decode_exact(buf: &mut &[u8], size: usize) -> Result<Self>
fn decode_exact(buf: &mut &[u8], size: usize) -> Result<Self>
Helper: Decode exactly size bytes from the buffer.
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.