pub enum KeyCompare {
Default,
Number,
Custom(fn(_: &[u8], _: &[u8]) -> Ordering),
}
Expand description
Variants§
Default
Use the default comparison behavior of the backend.
Currently, both heed
and redb
use
lexicographical comparison
by default, i.e. a straight byte comparison.
Number
A by-value number comparison, i.e. 255 < 256
.
This behavior is implemented as the default for all number primitives,
although some implementations on numbers use KeyCompare::Custom
due
to internal implementation details of LMDB.
Custom(fn(_: &[u8], _: &[u8]) -> Ordering)
A custom sorting function.
The input of the function is 2 Key
s in byte form.
Implementations§
Trait Implementations§
Source§impl Clone for KeyCompare
impl Clone for KeyCompare
Source§fn clone(&self) -> KeyCompare
fn clone(&self) -> KeyCompare
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for KeyCompare
impl Debug for KeyCompare
Source§impl Default for KeyCompare
impl Default for KeyCompare
Source§fn default() -> KeyCompare
fn default() -> KeyCompare
Returns the “default value” for a type. Read more
Source§impl Hash for KeyCompare
impl Hash for KeyCompare
Source§impl Ord for KeyCompare
impl Ord for KeyCompare
Source§fn cmp(&self, other: &KeyCompare) -> Ordering
fn cmp(&self, other: &KeyCompare) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for KeyCompare
impl PartialEq for KeyCompare
Source§impl PartialOrd for KeyCompare
impl PartialOrd for KeyCompare
impl Copy for KeyCompare
impl Eq for KeyCompare
impl StructuralPartialEq for KeyCompare
Auto Trait Implementations§
impl Freeze for KeyCompare
impl RefUnwindSafe for KeyCompare
impl Send for KeyCompare
impl Sync for KeyCompare
impl Unpin for KeyCompare
impl UnwindSafe for KeyCompare
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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: 16 bytes
Size for each variant:
Default
: 0 bytesNumber
: 0 bytesCustom
: 8 bytes