Trait toad_common::map::Map
source · [−]pub trait Map<K: Ord + Eq + Hash, V>: Default + GetSize + Reserve + Extend<(K, V)> + FromIterator<(K, V)> + IntoIterator<Item = (K, V)> {
fn insert(&mut self, key: K, val: V) -> Result<(), InsertError<V>>;
fn remove<Q: Hash + Eq + Ord>(&mut self, key: &Q) -> Option<V>
where
K: Borrow<Q>;
fn get<'a, Q: Hash + Eq + Ord>(&'a self, key: &Q) -> Option<&'a V>
where
K: Borrow<Q> + 'a;
fn get_mut<'a, Q: Hash + Eq + Ord>(
&'a mut self,
key: &Q
) -> Option<&'a mut V>
where
K: Borrow<Q> + 'a;
fn iter(&self) -> Iter<'_, K, V>ⓘNotable traits for Iter<'a, K, V>impl<'a, K: Eq + Hash, V> Iterator for Iter<'a, K, V> type Item = (&'a K, &'a V);;
fn iter_mut(&mut self) -> IterMut<'_, K, V>ⓘNotable traits for IterMut<'a, K, V>impl<'a, K: Eq + Hash, V> Iterator for IterMut<'a, K, V> type Item = (&'a K, &'a mut V);;
fn has<Q: Hash + Eq + Ord>(&self, key: &Q) -> bool
where
K: Borrow<Q>,
{ ... }
}Expand description
An collection of key-value pairs
Provided implementations
HashMap<K, V>tinyvec::ArrayVec<(K, V)>Vec<(K, V)>
Requirements
Defaultfor creating the mapExtendfor adding new entries to the mapReservefor reserving space ahead of timeGetSizefor bound checks, empty checks, and accessing the lengthFromIteratorforcollecting into the mapIntoIteratorfor iterating and destroying the map
Required Methods
sourcefn insert(&mut self, key: K, val: V) -> Result<(), InsertError<V>>
fn insert(&mut self, key: K, val: V) -> Result<(), InsertError<V>>
See [HashMap.insert]
sourcefn remove<Q: Hash + Eq + Ord>(&mut self, key: &Q) -> Option<V>where
K: Borrow<Q>,
fn remove<Q: Hash + Eq + Ord>(&mut self, key: &Q) -> Option<V>where
K: Borrow<Q>,
See [HashMap.remove]
sourcefn get<'a, Q: Hash + Eq + Ord>(&'a self, key: &Q) -> Option<&'a V>where
K: Borrow<Q> + 'a,
fn get<'a, Q: Hash + Eq + Ord>(&'a self, key: &Q) -> Option<&'a V>where
K: Borrow<Q> + 'a,
See [HashMap.get]
sourcefn get_mut<'a, Q: Hash + Eq + Ord>(&'a mut self, key: &Q) -> Option<&'a mut V>where
K: Borrow<Q> + 'a,
fn get_mut<'a, Q: Hash + Eq + Ord>(&'a mut self, key: &Q) -> Option<&'a mut V>where
K: Borrow<Q> + 'a,
See [HashMap.get_mut]