pub struct AssocMap<K: PartialEq, V> { /* private fields */ }Expand description
A simple association map with ordered insertion semantics.
Keys are maintained in insertion order; operations are O(n). Suitable for small collections used in elaboration.
Implementations§
Source§impl<K: PartialEq, V> AssocMap<K, V>
impl<K: PartialEq, V> AssocMap<K, V>
Sourcepub fn with_capacity(cap: usize) -> Self
pub fn with_capacity(cap: usize) -> Self
Create an AssocMap with initial capacity.
Sourcepub fn contains_key(&self, key: &K) -> bool
pub fn contains_key(&self, key: &K) -> bool
Check whether a key is present.
Sourcepub fn map_values<W>(self, f: impl Fn(V) -> W) -> AssocMap<K, W>
pub fn map_values<W>(self, f: impl Fn(V) -> W) -> AssocMap<K, W>
Map all values in place.
Sourcepub fn retain_keys(&mut self, pred: impl Fn(&K) -> bool)
pub fn retain_keys(&mut self, pred: impl Fn(&K) -> bool)
Remove all entries where the predicate on keys returns false.
Trait Implementations§
Auto Trait Implementations§
impl<K, V> Freeze for AssocMap<K, V>
impl<K, V> RefUnwindSafe for AssocMap<K, V>where
K: RefUnwindSafe,
V: RefUnwindSafe,
impl<K, V> Send for AssocMap<K, V>
impl<K, V> Sync for AssocMap<K, V>
impl<K, V> Unpin for AssocMap<K, V>
impl<K, V> UnsafeUnpin for AssocMap<K, V>
impl<K, V> UnwindSafe for AssocMap<K, V>where
K: UnwindSafe,
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