Trait leveldb::database::comparator::Comparator
[-] [+]
[src]
pub trait Comparator { type K: Key; fn name(&self) -> *const u8; fn compare(&self, a: &Self::K, b: &Self::K) -> Ordering; fn null() -> bool { ... } }
A comparator has two important functions:
- the name function returns a fixed name to detect errors when opening databases with a different name
- The comparison implementation
Associated Types
type K: Key
The type that the comparator compares.
Required Methods
fn name(&self) -> *const u8
Return the name of the Comparator
fn compare(&self, a: &Self::K, b: &Self::K) -> Ordering
compare two keys. This must implement a total ordering.
Provided Methods
Implementors
impl<K: Key + Ord> Comparator for OrdComparator<K>
impl Comparator for DefaultComparator