Trait bonsaidb_core::key::KeyEncoding
source · pub trait KeyEncoding<K = Self>: Send + Sync {
type Error: AnyError;
const LENGTH: Option<usize>;
// Required methods
fn describe<Visitor>(visitor: &mut Visitor)
where Visitor: KeyVisitor;
fn as_ord_bytes(&self) -> Result<Cow<'_, [u8]>, Self::Error>;
}
Expand description
A trait that enables a type to convert itself into a memcmp
-compatible
sequence of bytes.
Required Associated Types§
Required Associated Constants§
Required Methods§
sourcefn describe<Visitor>(visitor: &mut Visitor)where
Visitor: KeyVisitor,
fn describe<Visitor>(visitor: &mut Visitor)where Visitor: KeyVisitor,
Describes this type by invoking functions on visitor
describing the
key being encoded.
See the KeyVisitor
trait for more information.
KeyDescription::for_key()
/KeyDescription::for_encoding()
are
built-in functions