Trait Store
trait Store<K: ?Sized, V: ?Sized>: Sized
Trait to enable pluggable backends for LiteMap.
Some methods have default implementations provided for convenience; however, it is generally better to implement all methods that your data store supports.
Required Methods
fn lm_len(self: &Self) -> usizeReturns the number of elements in the store.
fn lm_get(self: &Self, index: usize) -> Option<(&K, &V)>Gets a key/value pair at the specified index.
fn lm_binary_search_by<F>(self: &Self, cmp: F) -> Result<usize, usize> where F: FnMut(&K) -> OrderingSearches the store for a particular element with a comparator function.
See the binary search implementation on
slicefor more information.
Provided Methods
fn lm_is_empty(self: &Self) -> boolReturns whether the store is empty (contains 0 elements).
fn lm_last(self: &Self) -> Option<(&K, &V)>Gets the last element in the store, or
Noneif the store is empty.
Implementors
impl<K, V> Store for Vec<(K, V)>impl<'a, K: 'a, V: 'a> Store for &'a [(K, V)]