Skip to main content

SearchableStoreRead

Trait SearchableStoreRead 

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

    // Provided method
    fn find(
        &self,
        pred: impl FnMut(&Self::Key, &Self::Value) -> bool,
    ) -> Option<(Self::Key, Self::Value)> { ... }
}
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(&Self::Key, &Self::Value) -> bool, ) -> Vec<(Self::Key, Self::Value)>

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(&Self::Key, &Self::Value) -> bool, ) -> Option<(Self::Key, Self::Value)>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§