Trait fixed_map::map::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
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
sourcetype Iter<'this>: Iterator<Item = (K, &'this V)>
where
Self: 'this,
V: 'this
type Iter<'this>: Iterator<Item = (K, &'this V)>
where
Self: 'this,
V: 'this
Immutable iterator over storage.
sourcetype Values<'this>: Iterator<Item = &'this V>
where
Self: 'this,
V: 'this
type Values<'this>: Iterator<Item = &'this V>
where
Self: 'this,
V: 'this
Immutable iterator over values in storage.
sourcetype IterMut<'this>: Iterator<Item = (K, &'this mut V)>
where
Self: 'this,
V: 'this
type IterMut<'this>: Iterator<Item = (K, &'this mut V)>
where
Self: 'this,
V: 'this
Mutable iterator over storage.
sourcetype ValuesMut<'this>: Iterator<Item = &'this mut V>
where
Self: 'this,
V: 'this
type ValuesMut<'this>: Iterator<Item = &'this mut V>
where
Self: 'this,
V: 'this
Mutable iterator over values in storage.
sourcetype Occupied<'this>: OccupiedEntry<'this, K, V>
where
Self: 'this
type Occupied<'this>: OccupiedEntry<'this, K, V>
where
Self: 'this
An occupied entry.
sourcetype Vacant<'this>: VacantEntry<'this, K, V>
where
Self: 'this
type Vacant<'this>: VacantEntry<'this, K, V>
where
Self: 'this
A vacant entry.
Required Methods
sourcefn insert(&mut self, key: K, value: V) -> Option<V>
fn insert(&mut self, key: K, value: V) -> Option<V>
This is the storage abstraction for Map::insert
.
sourcefn contains_key(&self, key: K) -> bool
fn contains_key(&self, key: K) -> bool
This is the storage abstraction for Map::contains_key
.
sourcefn get_mut(&mut self, key: K) -> Option<&mut V>
fn get_mut(&mut self, key: K) -> Option<&mut V>
This is the storage abstraction for Map::get_mut
.
sourcefn remove(&mut self, key: K) -> Option<V>
fn remove(&mut self, key: K) -> Option<V>
This is the storage abstraction for Map::remove
.
sourcefn retain<F>(&mut self, f: F)where
F: FnMut(K, &mut V) -> bool,
fn retain<F>(&mut self, f: F)where
F: FnMut(K, &mut V) -> bool,
This is the storage abstraction for Map::retain
.
sourcefn clear(&mut self)
fn clear(&mut self)
This is the storage abstraction for Map::clear
.
sourcefn values(&self) -> Self::Values<'_>
fn values(&self) -> Self::Values<'_>
This is the storage abstraction for Map::values
.
sourcefn iter_mut(&mut self) -> Self::IterMut<'_>
fn iter_mut(&mut self) -> Self::IterMut<'_>
This is the storage abstraction for Map::iter_mut
.
sourcefn values_mut(&mut self) -> Self::ValuesMut<'_>
fn values_mut(&mut self) -> Self::ValuesMut<'_>
This is the storage abstraction for Map::values_mut
.
sourcefn into_iter(self) -> Self::IntoIter
fn into_iter(self) -> Self::IntoIter
This is the storage abstraction for Map::into_iter
.
sourcefn entry(&mut self, key: K) -> Entry<'_, Self, K, V>
fn entry(&mut self, key: K) -> Entry<'_, Self, K, V>
This is the storage abstraction for Map::entry
.