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) -> usize

Returns 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) -> Ordering

Searches the store for a particular element with a comparator function.

See the binary search implementation on slice for more information.

Provided Methods

fn lm_is_empty(self: &Self) -> bool

Returns whether the store is empty (contains 0 elements).

fn lm_last(self: &Self) -> Option<(&K, &V)>

Gets the last element in the store, or None if the store is empty.

Implementors