pub struct Map<TKey, TValue>(/* private fields */);
Expand description
A small hashtable-like map with byte sized key indecies.
Implementations§
source§impl<K, V> Map<K, V>where
K: Collapse,
impl<K, V> Map<K, V>where K: Collapse,
sourcepub fn entry(&mut self, key: K) -> Entry<'_, K, V>
pub fn entry(&mut self, key: K) -> Entry<'_, K, V>
Get an Entry
for the key
that lets you get or insert the value
sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
The number of entries currently in this map
This is an iterating count over all slots in all current pages, if possible store it in a temporary instead of re-calling it.
sourcepub fn into_pages(self) -> Vec<Page<K, V>>
pub fn into_pages(self) -> Vec<Page<K, V>>
Consume the instance, returning all pages.
sourcepub fn values_mut(&mut self) -> impl Iterator<Item = &mut V>
pub fn values_mut(&mut self) -> impl Iterator<Item = &mut V>
A mutable iterator over all the values in the map
sourcepub fn iter_mut(&mut self) -> IterMut<'_, K, V> ⓘ
pub fn iter_mut(&mut self) -> IterMut<'_, K, V> ⓘ
A mutable iterator over all elements in the map
sourcepub fn with_capacity(pages: usize) -> Self
pub fn with_capacity(pages: usize) -> Self
Create a new empty Map
with a specific number of pages pre-allocated
sourcepub fn get_mut<Q>(&mut self, key: &Q) -> Option<&mut V>where
K: Borrow<Q>,
Q: Collapse + Eq + ?Sized,
pub fn get_mut<Q>(&mut self, key: &Q) -> Option<&mut V>where K: Borrow<Q>, Q: Collapse + Eq + ?Sized,
Get a mutable reference of the value corresponding to this key if it is in the map.
sourcepub fn contains_key<Q>(&self, key: &Q) -> boolwhere
K: Borrow<Q>,
Q: Collapse + Eq + ?Sized,
pub fn contains_key<Q>(&self, key: &Q) -> boolwhere K: Borrow<Q>, Q: Collapse + Eq + ?Sized,
Search the map for entry corresponding to this key
sourcepub fn get<Q>(&self, key: &Q) -> Option<&V>where
K: Borrow<Q>,
Q: Collapse + Eq + ?Sized,
pub fn get<Q>(&self, key: &Q) -> Option<&V>where K: Borrow<Q>, Q: Collapse + Eq + ?Sized,
Get a reference of the value corresponding to this key if it is in the map.
sourcepub fn remove<Q>(&mut self, key: &Q) -> Option<V>where
K: Borrow<Q>,
Q: Collapse + Eq + ?Sized,
pub fn remove<Q>(&mut self, key: &Q) -> Option<V>where K: Borrow<Q>, Q: Collapse + Eq + ?Sized,
Remove the entry corresponding to this key in the map, returning the value if it was present
Trait Implementations§
source§impl<K: Collapse, V> Extend<(K, V)> for Map<K, V>
impl<K: Collapse, V> Extend<(K, V)> for Map<K, V>
source§fn extend<T: IntoIterator<Item = (K, V)>>(&mut self, iter: T)
fn extend<T: IntoIterator<Item = (K, V)>>(&mut self, iter: T)
source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one
)source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one
)