pub struct UnorderedHashMap<Key: Hash + Eq, Value>(/* private fields */);
Expand description
A hash map that does not care about the order of insertion. In particular, it does not support iterating, in order to guarantee deterministic compilation. For an iterable version see OrderedHashMap.
Implementations§
source§impl<Key: Hash + Eq, Value> UnorderedHashMap<Key, Value>
impl<Key: Hash + Eq, Value> UnorderedHashMap<Key, Value>
sourcepub fn get_mut<Q>(&mut self, key: &Q) -> Option<&mut Value>where
Key: Borrow<Q>,
Q: Hash + Eq + ?Sized,
pub fn get_mut<Q>(&mut self, key: &Q) -> Option<&mut Value>where Key: Borrow<Q>, Q: Hash + Eq + ?Sized,
sourcepub fn insert(&mut self, key: Key, value: Value) -> Option<Value>
pub fn insert(&mut self, key: Key, value: Value) -> Option<Value>
Inserts a key-value pair into the map.
If the map did not have this key present, None is returned.
If the map did have this key present, the value is updated, and the old value is returned. The key is not updated, though; this matters for types that can be == without being identical.
sourcepub fn remove<Q>(&mut self, key: &Q) -> Option<Value>where
Key: Borrow<Q>,
Q: Hash + Eq + ?Sized,
pub fn remove<Q>(&mut self, key: &Q) -> Option<Value>where Key: Borrow<Q>, Q: Hash + Eq + ?Sized,
Removes a key from the map, returning the value at the key if the key was previously in the map.
The key may be any borrowed form of the map’s key type, but Hash and Eq on the borrowed form must match those for the key type.
sourcepub fn entry(&mut self, key: Key) -> Entry<'_, Key, Value>
pub fn entry(&mut self, key: Key) -> Entry<'_, Key, Value>
Gets the given key’s corresponding entry in the map for in-place manipulation.
Trait Implementations§
source§impl<Key: Clone + Hash + Eq, Value: Clone> Clone for UnorderedHashMap<Key, Value>
impl<Key: Clone + Hash + Eq, Value: Clone> Clone for UnorderedHashMap<Key, Value>
source§fn clone(&self) -> UnorderedHashMap<Key, Value>
fn clone(&self) -> UnorderedHashMap<Key, Value>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl<Key: Hash + Eq, Value, const N: usize> From<[(Key, Value); N]> for UnorderedHashMap<Key, Value>
impl<Key: Hash + Eq, Value, const N: usize> From<[(Key, Value); N]> for UnorderedHashMap<Key, Value>
source§fn from(items: [(Key, Value); N]) -> Self
fn from(items: [(Key, Value); N]) -> Self
source§impl<Key: Hash + Eq, Value> FromIterator<(Key, Value)> for UnorderedHashMap<Key, Value>
impl<Key: Hash + Eq, Value> FromIterator<(Key, Value)> for UnorderedHashMap<Key, Value>
source§fn from_iter<T: IntoIterator<Item = (Key, Value)>>(iter: T) -> Self
fn from_iter<T: IntoIterator<Item = (Key, Value)>>(iter: T) -> Self
source§impl<Key, Q, Value> Index<&Q> for UnorderedHashMap<Key, Value>where
Key: Eq + Hash + Borrow<Q>,
Q: Eq + Hash + ?Sized,
impl<Key, Q, Value> Index<&Q> for UnorderedHashMap<Key, Value>where Key: Eq + Hash + Borrow<Q>, Q: Eq + Hash + ?Sized,
source§impl<Key: PartialEq + Hash + Eq, Value: PartialEq> PartialEq for UnorderedHashMap<Key, Value>
impl<Key: PartialEq + Hash + Eq, Value: PartialEq> PartialEq for UnorderedHashMap<Key, Value>
source§fn eq(&self, other: &UnorderedHashMap<Key, Value>) -> bool
fn eq(&self, other: &UnorderedHashMap<Key, Value>) -> bool
self
and other
values to be equal, and is used
by ==
.impl<Key: Eq + Hash + Eq, Value: Eq> Eq for UnorderedHashMap<Key, Value>
impl<Key: Hash + Eq, Value> StructuralEq for UnorderedHashMap<Key, Value>
impl<Key: Hash + Eq, Value> StructuralPartialEq for UnorderedHashMap<Key, Value>
Auto Trait Implementations§
impl<Key, Value> RefUnwindSafe for UnorderedHashMap<Key, Value>where Key: RefUnwindSafe, Value: RefUnwindSafe,
impl<Key, Value> Send for UnorderedHashMap<Key, Value>where Key: Send, Value: Send,
impl<Key, Value> Sync for UnorderedHashMap<Key, Value>where Key: Sync, Value: Sync,
impl<Key, Value> Unpin for UnorderedHashMap<Key, Value>where Key: Unpin, Value: Unpin,
impl<Key, Value> UnwindSafe for UnorderedHashMap<Key, Value>where Key: UnwindSafe, Value: 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
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.