pub trait Decode: Sized {
// Required method
fn decode<I: Input>(input: &mut I) -> Result<Self, Error>;
// Provided methods
fn skip<I: Input>(input: &mut I) -> Result<(), Error> { ... }
fn encoded_fixed_size() -> Option<usize> { ... }
}
Expand description
Trait that allows zero-copy read of value-references from slices in LE format.
Required Methods§
Provided Methods§
Sourcefn skip<I: Input>(input: &mut I) -> Result<(), Error>
fn skip<I: Input>(input: &mut I) -> Result<(), Error>
Attempt to skip the encoded value from input.
The default implementation of this function is just calling Decode::decode
.
When possible, an implementation should provided a specialized implementation.
Sourcefn encoded_fixed_size() -> Option<usize>
fn encoded_fixed_size() -> Option<usize>
Returns the fixed encoded size of the type.
If it returns Some(size)
then all possible values of this
type have the given size (in bytes) when encoded.
NOTE: A type with a fixed encoded size may return None
.
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.