Trait bonsaidb::core::key::KeyEncoding[][src]

pub trait KeyEncoding<'k, K>: Debug + Send + Sync where
    K: Key<'k>, 
{ type Error: AnyError; const LENGTH: Option<usize>; fn as_ord_bytes(&'k self) -> Result<Cow<'k, [u8]>, Self::Error>; }
Expand description

A trait that enables a type to convert itself into a memcmp-compatible sequence of bytes.

Associated Types

The error type that can be produced by either serialization or deserialization.

Associated Constants

The size of the key, if constant. If this type doesn’t produce the same number of bytes for each value, this should be None.

Required methods

Convert self into a Cow<[u8]> containing bytes that are able to be compared via memcmp in a way that is comptaible with its own Ord implementation.

Implementations on Foreign Types


Panics if T::into_big_endian_bytes returns an empty IVec.