pub trait KeyDecode: Sized {
// Required method
fn decode_from(buf: &mut &[u8]) -> StoreResult<Self>;
// Provided method
fn decode(bytes: &[u8]) -> StoreResult<Self> { ... }
}Expand description
The inverse of KeyEncode: decode a value from the front of a byte cursor,
advancing the cursor past the bytes consumed (so tuple components decode in
sequence).
Required Methods§
Sourcefn decode_from(buf: &mut &[u8]) -> StoreResult<Self>
fn decode_from(buf: &mut &[u8]) -> StoreResult<Self>
Decode from the front of buf, advancing buf past the consumed bytes.
Provided Methods§
Sourcefn decode(bytes: &[u8]) -> StoreResult<Self>
fn decode(bytes: &[u8]) -> StoreResult<Self>
Decode a value that occupies the entire slice; errors if trailing bytes remain.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".