Enum heed::DefaultComparator
source · pub enum DefaultComparator {}
Expand description
A representation of LMDB’s default comparator behavior.
This enum is used to indicate the absence of a custom comparator for an LMDB
database instance. When a Database
is created or opened with
DefaultComparator
, it signifies that the comparator should not be explicitly
set via ffi::mdb_set_compare
. Consequently, the database
instance utilizes LMDB’s built-in default comparator, which inherently performs
lexicographic comparison of keys.
This comparator’s lexicographic implementation is employed in scenarios involving
prefix iterators. Specifically, methods other than Comparator::compare
are utilized
to determine the lexicographic successors and predecessors of byte sequences, which
is essential for these iterators’ operation.
When a custom comparator is provided, the wrapper is responsible for setting
it with the ffi::mdb_set_compare
function, which overrides the default comparison
behavior of LMDB with the user-defined logic.
Trait Implementations§
source§impl LexicographicComparator for DefaultComparator
impl LexicographicComparator for DefaultComparator
source§fn compare_elem(a: u8, b: u8) -> Ordering
fn compare_elem(a: u8, b: u8) -> Ordering
Comparator::compare
by definition of lexicographic ordering. Read moresource§fn successor(elem: u8) -> Option<u8>
fn successor(elem: u8) -> Option<u8>
elem
to its immediate lexicographic successor, if possible.
Returns None
if elem
is already at its maximum value with respect to the
lexicographic order defined by this comparator.