pub struct SmallMap<K, V>(/* private fields */);Expand description
A map, ordered by key, small in memory while it holds few entries.
Implementations§
Source§impl<K, V> SmallMap<K, V>
impl<K, V> SmallMap<K, V>
Sourcepub fn keys(&self) -> impl DoubleEndedIterator<Item = &K> + ExactSizeIterator
pub fn keys(&self) -> impl DoubleEndedIterator<Item = &K> + ExactSizeIterator
The keys, in order.
Sourcepub fn values(&self) -> impl DoubleEndedIterator<Item = &V> + ExactSizeIterator
pub fn values(&self) -> impl DoubleEndedIterator<Item = &V> + ExactSizeIterator
The values, in the order of their keys.
Source§impl<K: Ord, V> SmallMap<K, V>
impl<K: Ord, V> SmallMap<K, V>
Sourcepub fn contains_key(&self, key: &K) -> bool
pub fn contains_key(&self, key: &K) -> bool
Whether it holds a key.
Sourcepub fn insert(&mut self, key: K, value: V) -> Option<V>
pub fn insert(&mut self, key: K, value: V) -> Option<V>
Sets the value of a key, and returns the value it had.
Sourcepub fn get_or_insert_with(
&mut self,
key: K,
default: impl FnOnce() -> V,
) -> &mut V
pub fn get_or_insert_with( &mut self, key: K, default: impl FnOnce() -> V, ) -> &mut V
The value of a key, which default makes if the map has none, to change.
Trait Implementations§
impl<K: Eq, V: Eq> Eq for SmallMap<K, V>
Source§impl<'a, K, V> IntoIterator for &'a SmallMap<K, V>
impl<'a, K, V> IntoIterator for &'a SmallMap<K, V>
Auto Trait Implementations§
impl<K, V> Forget for SmallMap<K, V>
impl<K, V> Freeze for SmallMap<K, V>where
MapRepr<K, V>: Freeze,
impl<K, V> Move for SmallMap<K, V>
impl<K, V> RefUnwindSafe for SmallMap<K, V>where
MapRepr<K, V>: RefUnwindSafe,
impl<K, V> Send for SmallMap<K, V>where
MapRepr<K, V>: Send,
impl<K, V> Sync for SmallMap<K, V>where
MapRepr<K, V>: Sync,
impl<K, V> Unpin for SmallMap<K, V>where
MapRepr<K, V>: Unpin,
impl<K, V> UnsafeUnpin for SmallMap<K, V>where
MapRepr<K, V>: UnsafeUnpin,
impl<K, V> UnwindSafe for SmallMap<K, V>where
MapRepr<K, V>: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more