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

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; }

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

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

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

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

Loading content...

Required methods

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

This is the storage abstraction for Map::insert.

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

This is the storage abstraction for Map::get.

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

This is the storage abstraction for Map::get_mut.

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

This is the storage abstraction for Map::remove.

fn clear(&mut self)

This is the storage abstraction for Map::clear.

fn iter(&self) -> Self::Iter

This is the storage abstraction for Map::iter.

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

This is the storage abstraction for Map::iter_mut.

Loading content...

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>

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>

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>

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

type Iter = Iter<V>

type IterMut = IterMut<V>

Loading content...