pub struct OrderedHashMap<K, V> { /* private fields */ }Implementations§
Source§impl<K, V> OrderedHashMap<K, V>
impl<K, V> OrderedHashMap<K, V>
pub fn new() -> Self
pub fn with_capacity(capacity: usize) -> Self
pub fn len(&self) -> usize
pub fn capacity(&self) -> usize
pub fn is_empty(&self) -> bool
Sourcepub fn iter(&self) -> impl Iterator<Item = (&K, &V)>
pub fn iter(&self) -> impl Iterator<Item = (&K, &V)>
Iterator over (&K, &V) in insertion order.
Sourcepub fn iter_mut(&mut self) -> impl Iterator<Item = (&K, &mut V)>
pub fn iter_mut(&mut self) -> impl Iterator<Item = (&K, &mut V)>
Iterator over (&K, &mut V) in insertion order.
pub fn for_each_mut(&mut self, f: impl FnMut(&K, &mut V))
👎Deprecated: use
iter_mut insteadSource§impl<K: Eq + Hash, V> OrderedHashMap<K, V>
impl<K: Eq + Hash, V> OrderedHashMap<K, V>
Sourcepub fn insert(&mut self, key: K, value: V) -> Option<V>where
K: Clone,
pub fn insert(&mut self, key: K, value: V) -> Option<V>where
K: Clone,
Insert a key-value pair.
- If the key is new: appends to the end; returns
None. - If the key exists: replaces the value in-place; returns
Some(old_v).
pub fn get<Q: Eq + Hash + ?Sized>(&self, key: &Q) -> Option<&V>where
K: Borrow<Q>,
pub fn get_mut<Q: Eq + Hash + ?Sized>(&mut self, key: &Q) -> Option<&mut V>where
K: Borrow<Q>,
pub fn contains_key<Q: Eq + Hash + ?Sized>(&self, key: &Q) -> boolwhere
K: Borrow<Q>,
Sourcepub fn remove<Q: Eq + Hash + ?Sized>(&mut self, key: &Q) -> Option<V>where
K: Borrow<Q>,
pub fn remove<Q: Eq + Hash + ?Sized>(&mut self, key: &Q) -> Option<V>where
K: Borrow<Q>,
Removes key if present and returns its value, in O(1).
pub fn remove_entry<Q: Eq + Hash + ?Sized>(&mut self, key: &Q) -> Option<(K, V)>where
K: Borrow<Q>,
pub fn pop_front(&mut self) -> Option<(K, V)>
pub fn pop_back(&mut self) -> Option<(K, V)>
pub fn clear(&mut self)
pub fn entry(&mut self, key: K) -> Entry<'_, K, V>
pub fn shrink_to(&mut self, min_capacity: usize)
pub fn shrink_to_fit(&mut self)
Trait Implementations§
Auto Trait Implementations§
impl<K, V> Freeze for OrderedHashMap<K, V>
impl<K, V> RefUnwindSafe for OrderedHashMap<K, V>where
K: RefUnwindSafe,
V: RefUnwindSafe,
impl<K, V> Send for OrderedHashMap<K, V>
impl<K, V> Sync for OrderedHashMap<K, V>
impl<K, V> Unpin for OrderedHashMap<K, V>
impl<K, V> UnwindSafe for OrderedHashMap<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