Trait litemap::store::StoreMut

source ·
pub trait StoreMut<K, V>: Store<K, V> {
    // Required methods
    fn lm_with_capacity(capacity: usize) -> Self;
    fn lm_reserve(&mut self, additional: usize);
    fn lm_get_mut(&mut self, index: usize) -> Option<(&K, &mut V)>;
    fn lm_push(&mut self, key: K, value: V);
    fn lm_insert(&mut self, index: usize, key: K, value: V);
    fn lm_remove(&mut self, index: usize) -> (K, V);
    fn lm_clear(&mut self);

    // Provided method
    fn lm_retain<F>(&mut self, predicate: F)
       where F: FnMut(&K, &V) -> bool { ... }
}

Required Methods§

source

fn lm_with_capacity(capacity: usize) -> Self

Creates a new store with the specified capacity hint.

Implementations may ignore the argument if they do not support pre-allocating capacity.

source

fn lm_reserve(&mut self, additional: usize)

Reserves additional capacity in the store.

Implementations may ignore the argument if they do not support pre-allocating capacity.

source

fn lm_get_mut(&mut self, index: usize) -> Option<(&K, &mut V)>

Gets a key/value pair at the specified index, with a mutable value.

source

fn lm_push(&mut self, key: K, value: V)

Pushes one additional item onto the store.

source

fn lm_insert(&mut self, index: usize, key: K, value: V)

Inserts an item at a specific index in the store.

§Panics

Panics if index is greater than the length.

source

fn lm_remove(&mut self, index: usize) -> (K, V)

Removes an item at a specific index in the store.

§Panics

Panics if index is greater than the length.

source

fn lm_clear(&mut self)

Removes all items from the store.

Provided Methods§

source

fn lm_retain<F>(&mut self, predicate: F)
where F: FnMut(&K, &V) -> bool,

Retains items satisfying a predicate in this store.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<K, V> StoreMut<K, V> for Vec<(K, V)>

source§

fn lm_with_capacity(capacity: usize) -> Self

source§

fn lm_reserve(&mut self, additional: usize)

source§

fn lm_get_mut(&mut self, index: usize) -> Option<(&K, &mut V)>

source§

fn lm_push(&mut self, key: K, value: V)

source§

fn lm_insert(&mut self, index: usize, key: K, value: V)

source§

fn lm_remove(&mut self, index: usize) -> (K, V)

source§

fn lm_clear(&mut self)

source§

fn lm_retain<F>(&mut self, predicate: F)
where F: FnMut(&K, &V) -> bool,

Implementors§