heed

Enum 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)