Skip to main content

SearchableStoreRead

Trait SearchableStoreRead 

Source
pub trait SearchableStoreRead<K: Ord, V>: OrderedStoreRead<K, V> {
    // Required method
    fn filter(&self, pred: impl FnMut(&K, &V) -> bool) -> Vec<(K, V)>;

    // Provided method
    fn find(&self, pred: impl FnMut(&K, &V) -> bool) -> Option<(K, V)> { ... }
}
Expand description

Extension to a OrderedStoreRead, that allows looking through the store to look for specific entries,

Required Methods§

Source

fn filter(&self, pred: impl FnMut(&K, &V) -> bool) -> Vec<(K, V)>

Search for all entries in the store, that fulfill a certain predicate

Note that the elements are being searched through in the order specified by Ord of key

§Arguments
  • pred: A predicate that has access to the key and value
§Returns
  • An array of key-value pairs, for which pred holds true

Provided Methods§

Source

fn find(&self, pred: impl FnMut(&K, &V) -> bool) -> Option<(K, V)>

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.

Implementors§

Source§

impl<K: Ord + Clone, V: Clone> SearchableStoreRead<K, V> for MemoryStore<K, V>