Skip to main content

KeyDecode

Trait KeyDecode 

Source
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§

Source

fn decode_from(buf: &mut &[u8]) -> StoreResult<Self>

Decode from the front of buf, advancing buf past the consumed bytes.

Provided Methods§

Source

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".

Implementations on Foreign Types§

Source§

impl KeyDecode for String

Source§

fn decode_from(buf: &mut &[u8]) -> StoreResult<Self>

Source§

impl KeyDecode for i64

Source§

fn decode_from(buf: &mut &[u8]) -> StoreResult<Self>

Source§

impl KeyDecode for u64

Source§

fn decode_from(buf: &mut &[u8]) -> StoreResult<Self>

Source§

impl<A: KeyDecode, B: KeyDecode, C: KeyDecode> KeyDecode for (A, B, C)

Source§

fn decode_from(buf: &mut &[u8]) -> StoreResult<Self>

Source§

impl<A: KeyDecode, B: KeyDecode> KeyDecode for (A, B)

Source§

fn decode_from(buf: &mut &[u8]) -> StoreResult<Self>

Implementors§