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§
Sourcefn encode_key(&self, key: &K) -> Result<Vec<u8>, Error>
fn encode_key(&self, key: &K) -> Result<Vec<u8>, Error>
Encode one typed key into its order-preserving byte representation.
Sourcefn decode_key(&self, bytes: &[u8]) -> Result<K, Error>
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".