pub trait DecodeValue: Sized {
// Required method
fn decode_from(buffer: &[u8]) -> Result<(Self, &[u8])>;
// Provided method
fn decode_from_exact(buffer: &[u8]) -> Result<Self> { ... }
}
Expand description
This trait defines a type that can be decoded from bytes.
Required Methods§
fn decode_from(buffer: &[u8]) -> Result<(Self, &[u8])>
Provided Methods§
Sourcefn decode_from_exact(buffer: &[u8]) -> Result<Self>
fn decode_from_exact(buffer: &[u8]) -> Result<Self>
decode a value from buffer
, using all of the bytes.
If buffer was not entirely consumed, an error is returned.
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.