Trait fixed_map::storage::Storage[][src]

pub trait Storage<K, V>: Default {
    type Iter: Clone + Iterator<Item = (K, *const V)>;
    type IterMut: Iterator<Item = (K, *mut V)>;
    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.

Associated Types

type Iter: Clone + Iterator<Item = (K, *const V)>[src]

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

type IterMut: Iterator<Item = (K, *mut V)>[src]

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

Required methods

fn insert(&mut self, key: K, value: V) -> Option<V>[src]

This is the storage abstraction for Map::insert.

fn get(&self, key: K) -> Option<&V>[src]

This is the storage abstraction for Map::get.

fn get_mut(&mut self, key: K) -> Option<&mut V>[src]

This is the storage abstraction for Map::get_mut.

fn remove(&mut self, key: K) -> Option<V>[src]

This is the storage abstraction for Map::remove.

fn clear(&mut self)[src]

This is the storage abstraction for Map::clear.

fn iter(&self) -> Self::Iter[src]

This is the storage abstraction for Map::iter.

fn iter_mut(&mut self) -> Self::IterMut[src]

This is the storage abstraction for Map::iter_mut.

Implementors

impl<K, V> Storage<Option<K>, V> for OptionStorage<K, V> where
    K: Key<K, V>, 
[src]

type Iter = Iter<K, V>

type IterMut = IterMut<K, V>

fn insert(&mut self, key: Option<K>, value: V) -> Option<V>[src]

fn get(&self, key: Option<K>) -> Option<&V>[src]

fn get_mut(&mut self, key: Option<K>) -> Option<&mut V>[src]

fn remove(&mut self, key: Option<K>) -> Option<V>[src]

fn clear(&mut self)[src]

fn iter(&self) -> Self::Iter[src]

fn iter_mut(&mut self) -> Self::IterMut[src]

impl<K, V> Storage<K, V> for MapStorage<K, V> where
    K: Copy + Eq + Hash
[src]

type Iter = Iter<K, V>

type IterMut = IterMut<K, V>

fn insert(&mut self, key: K, value: V) -> Option<V>[src]

fn get(&self, key: K) -> Option<&V>[src]

fn get_mut(&mut self, key: K) -> Option<&mut V>[src]

fn remove(&mut self, key: K) -> Option<V>[src]

fn clear(&mut self)[src]

fn iter(&self) -> Self::Iter[src]

fn iter_mut(&mut self) -> Self::IterMut[src]

impl<K, V> Storage<K, V> for SingletonStorage<K, V> where
    K: Copy + Default
[src]

type Iter = Iter<K, V>

type IterMut = IterMut<K, V>

fn insert(&mut self, _: K, value: V) -> Option<V>[src]

fn get(&self, _: K) -> Option<&V>[src]

fn get_mut(&mut self, _: K) -> Option<&mut V>[src]

fn remove(&mut self, _: K) -> Option<V>[src]

fn clear(&mut self)[src]

fn iter(&self) -> Self::Iter[src]

fn iter_mut(&mut self) -> Self::IterMut[src]

impl<V> Storage<bool, V> for BooleanStorage<V>[src]

type Iter = Iter<V>

type IterMut = IterMut<V>

fn insert(&mut self, key: bool, value: V) -> Option<V>[src]

fn get(&self, key: bool) -> Option<&V>[src]

fn get_mut(&mut self, key: bool) -> Option<&mut V>[src]

fn remove(&mut self, key: bool) -> Option<V>[src]

fn clear(&mut self)[src]

fn iter(&self) -> Self::Iter[src]

fn iter_mut(&mut self) -> Self::IterMut[src]