Trait pearl::Key

source ·
pub trait Key<'a>: AsRef<[u8]> + From<Vec<u8>> + From<&'a [u8]> + Debug + Clone + Send + Sync + Ord + Default {
    type Ref: RefKey<'a>;

    const LEN: u16;
    const MEM_SIZE: usize;

    // Provided methods
    fn to_vec(&self) -> Vec<u8> { ... }
    fn as_ref_key(&'a self) -> Self::Ref { ... }
}
Expand description

Trait Key

Required Associated Types§

source

type Ref: RefKey<'a>

Reference type for zero-copy key creation

Required Associated Constants§

source

const LEN: u16

Key must have fixed length

source

const MEM_SIZE: usize

Size of key in memory

Provided Methods§

source

fn to_vec(&self) -> Vec<u8>

Convert Self into Vec<u8>

source

fn as_ref_key(&'a self) -> Self::Ref

Convert Self to Self::Ref

Implementors§

source§

impl<'a, const N: usize> Key<'a> for ArrayKey<N>

source§

const LEN: u16 = _

source§

const MEM_SIZE: usize = _

§

type Ref = SliceKey<'a>