Skip to main content

KeyCodec

Trait KeyCodec 

Source
pub trait KeyCodec {
    type Key: Clone + Ord + Debug;

    // Required methods
    fn encoded_len(key: &Self::Key) -> usize;
    fn encode_into(key: &Self::Key, out: &mut Vec<u8>);
    fn decode_from(bytes: &[u8]) -> Result<Self::Key, Error>;
    fn compare_encoded(encoded: &[u8], key: &Self::Key) -> Ordering;
    fn cmp_enc_vs_enc(a: &[u8], b: &[u8]) -> Ordering;
}

Required Associated Types§

Required Methods§

Source

fn encoded_len(key: &Self::Key) -> usize

Source

fn encode_into(key: &Self::Key, out: &mut Vec<u8>)

Source

fn decode_from(bytes: &[u8]) -> Result<Self::Key, Error>

Source

fn compare_encoded(encoded: &[u8], key: &Self::Key) -> Ordering

Source

fn cmp_enc_vs_enc(a: &[u8], b: &[u8]) -> Ordering

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§

Source§

impl KeyCodec for StringKeyCodec

Source§

impl<T: Int> KeyCodec for BigEndianKeyCodec<T>
where T::Bytes: Debug, for<'a> <T::Bytes as TryFrom<&'a [u8]>>::Error: Debug,

Source§

type Key = T