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

source§

fn compare_elem(a: u8, b: u8) -> Ordering

Compare a single byte; this function is used to implement Comparator::compare by definition of lexicographic ordering. Read more
source§

fn successor(elem: u8) -> Option<u8>

Advances the given 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.
source§

fn predecessor(elem: u8) -> Option<u8>

Moves the given elem to its immediate lexicographic predecessor, if possible. Returns None if elem is already at its minimum value with respect to the lexicographic order defined by this comparator.
source§

fn max_elem() -> u8

Returns the maximum byte value per the comparator’s lexicographic order.
source§

fn min_elem() -> u8

Returns the minimum byte value per the comparator’s lexicographic order.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<C> Comparator for C

source§

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

Compares the raw bytes representation of two keys. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.

Layout§

Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.

Size: 0 bytes (uninhabited)