Trait MapStorage

Source
pub trait MapStorage<K, V>: Sized {
    type Iter<'this>: Iterator<Item = (K, &'this V)>
       where Self: 'this,
             V: 'this;
    type Keys<'this>: Iterator<Item = K>
       where Self: 'this;
    type Values<'this>: Iterator<Item = &'this V>
       where Self: 'this,
             V: 'this;
    type IterMut<'this>: Iterator<Item = (K, &'this mut V)>
       where Self: 'this,
             V: 'this;
    type ValuesMut<'this>: Iterator<Item = &'this mut V>
       where Self: 'this,
             V: 'this;
    type IntoIter: Iterator<Item = (K, V)>;
    type Occupied<'this>: OccupiedEntry<'this, K, V>
       where Self: 'this;
    type Vacant<'this>: VacantEntry<'this, K, V>
       where Self: 'this;

Show 17 methods // Required methods fn empty() -> Self; fn len(&self) -> usize; fn is_empty(&self) -> bool; fn insert(&mut self, key: K, value: V) -> Option<V>; fn contains_key(&self, key: K) -> bool; 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 retain<F>(&mut self, f: F) where F: FnMut(K, &mut V) -> bool; fn clear(&mut self); fn iter(&self) -> Self::Iter<'_>; fn keys(&self) -> Self::Keys<'_>; fn values(&self) -> Self::Values<'_>; fn iter_mut(&mut self) -> Self::IterMut<'_>; fn values_mut(&mut self) -> Self::ValuesMut<'_>; fn into_iter(self) -> Self::IntoIter; fn entry(&mut self, key: K) -> Entry<'_, Self, K, V>;
}
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§

Source

type Iter<'this>: Iterator<Item = (K, &'this V)> where Self: 'this, V: 'this

Immutable iterator over storage.

Source

type Keys<'this>: Iterator<Item = K> where Self: 'this

Immutable iterator over keys in storage.

Source

type Values<'this>: Iterator<Item = &'this V> where Self: 'this, V: 'this

Immutable iterator over values in storage.

Source

type IterMut<'this>: Iterator<Item = (K, &'this mut V)> where Self: 'this, V: 'this

Mutable iterator over storage.

Source

type ValuesMut<'this>: Iterator<Item = &'this mut V> where Self: 'this, V: 'this

Mutable iterator over values in storage.

Source

type IntoIter: Iterator<Item = (K, V)>

Consuming iterator.

Source

type Occupied<'this>: OccupiedEntry<'this, K, V> where Self: 'this

An occupied entry.

Source

type Vacant<'this>: VacantEntry<'this, K, V> where Self: 'this

A vacant entry.

Required Methods§

Source

fn empty() -> Self

Construct empty storage.

Source

fn len(&self) -> usize

Get the length of storage.

Source

fn is_empty(&self) -> bool

Check if storage is empty.

Source

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

This is the storage abstraction for Map::insert.

Source

fn contains_key(&self, key: K) -> bool

This is the storage abstraction for Map::contains_key.

Source

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

This is the storage abstraction for Map::get.

Source

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

This is the storage abstraction for Map::get_mut.

Source

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

This is the storage abstraction for Map::remove.

Source

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

This is the storage abstraction for Map::retain.

Source

fn clear(&mut self)

This is the storage abstraction for Map::clear.

Source

fn iter(&self) -> Self::Iter<'_>

This is the storage abstraction for Map::iter.

Source

fn keys(&self) -> Self::Keys<'_>

This is the storage abstraction for Map::keys.

Source

fn values(&self) -> Self::Values<'_>

This is the storage abstraction for Map::values.

Source

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

This is the storage abstraction for Map::iter_mut.

Source

fn values_mut(&mut self) -> Self::ValuesMut<'_>

This is the storage abstraction for Map::values_mut.

Source

fn into_iter(self) -> Self::IntoIter

This is the storage abstraction for Map::into_iter.

Source

fn entry(&mut self, key: K) -> Entry<'_, Self, K, V>

This is the storage abstraction for Map::entry.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§