pub trait Storage<K, V>: Default {
    type Iter<'this>: Clone + Iterator<Item = (K, &'this V)>
    where
        Self: 'this,
        V: 'this
; type IterMut<'this>: Iterator<Item = (K, &'this mut V)>
    where
        Self: 'this,
        V: 'this
; fn insert(&mut self, key: K, value: V) -> Option<V>; fn get(&self, key: K) -> Option<&V>; fn get_mut(&mut self, key: K) -> Option<&mut V>; fn remove(&mut self, key: K) -> Option<V>; fn clear(&mut self); fn iter(&self) -> Self::Iter<'_>; fn iter_mut(&mut self) -> Self::IterMut<'_>; }
Expand description

The trait defining how storage works.

Type Arguments

  • K is the key being stored.
  • V is the value being stored.

Required Associated Types

Immutable iterator over storage. Uses raw pointers (unsafe) since we don’t have GATs.

Mutable iterator over storage. Uses raw pointers (unsafe) since we don’t have GATs.

Required Methods

This is the storage abstraction for Map::insert.

This is the storage abstraction for Map::get.

This is the storage abstraction for Map::get_mut.

This is the storage abstraction for Map::remove.

This is the storage abstraction for Map::clear.

This is the storage abstraction for Map::iter.

This is the storage abstraction for Map::iter_mut.

Implementors