Skip to main content

KeyCodec

Trait KeyCodec 

Source
pub trait KeyCodec<K> {
    // Required methods
    fn encode_key(&self, key: &K) -> Result<Vec<u8>, Error>;
    fn decode_key(&self, bytes: &[u8]) -> Result<K, Error>;
}
Expand description

Codec for converting typed application keys to and from ordered map bytes.

Required Methods§

Source

fn encode_key(&self, key: &K) -> Result<Vec<u8>, Error>

Encode one typed key into its order-preserving byte representation.

Source

fn decode_key(&self, bytes: &[u8]) -> Result<K, Error>

Decode one stored key.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§