pub trait StoreWithComparator<K, V, C>: Store<K, V>where
C: Comparator<V>,{
// Required method
fn with_comparator(comparator: C) -> Self;
}Expand description
Creates a store with a comparator.
This trait extends Store, adding the capability to create a store with
a custom comparator, allowing to customize the ordering of values.
§Examples
use std::collections::HashMap;
use zrx_store::comparator::Descending;
use zrx_store::decorator::Ordered;
use zrx_store::{StoreMut, StoreWithComparator};
// Create store
let mut store: Ordered::<_, _, HashMap<_, _>, _> =
Ordered::with_comparator(Descending);
// Insert value
store.insert("key", 42);Required Methods§
Sourcefn with_comparator(comparator: C) -> Self
fn with_comparator(comparator: C) -> Self
Creates a store with the given comparator.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.