pub struct HashMap<K: 'static, V: 'static, S = FixedState> { /* private fields */ }Expand description
High-Performance Lock-Free Map.
Implementations§
Source§impl<K, V> HashMap<K, V, FixedState>
impl<K, V> HashMap<K, V, FixedState>
Source§impl<K, V, S> HashMap<K, V, S>
impl<K, V, S> HashMap<K, V, S>
Sourcepub fn with_hasher(hasher: S) -> Self
pub fn with_hasher(hasher: S) -> Self
Creates a new hash map with custom hasher.
Sourcepub fn contains_key<Q>(&self, key: &Q) -> bool
pub fn contains_key<Q>(&self, key: &Q) -> bool
Checks if the key exists.
Sourcepub fn insert_if_absent(&self, key: K, value: V) -> Option<V>
pub fn insert_if_absent(&self, key: K, value: V) -> Option<V>
Insert a key-value pair only if the key does not exist.
Returns None if inserted, Some(existing_value) if the key already exists.
Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Returns the number of elements in the map. Note: This is an O(N) operation as it scans all buckets.
Sourcepub fn iter(&self) -> Iter<'_, K, V, S> ⓘ
pub fn iter(&self) -> Iter<'_, K, V, S> ⓘ
Returns an iterator over the map entries. Yields (K, V) clones.
Trait Implementations§
Source§impl<K, V> Default for HashMap<K, V, FixedState>
Available on crate feature std only.
impl<K, V> Default for HashMap<K, V, FixedState>
Available on crate feature
std only.Source§impl<'a, K, V, S> IntoIterator for &'a HashMap<K, V, S>
impl<'a, K, V, S> IntoIterator for &'a HashMap<K, V, S>
impl<K: Send, V: Send, S: Send> Send for HashMap<K, V, S>
impl<K: Sync, V: Sync, S: Sync> Sync for HashMap<K, V, S>
Auto Trait Implementations§
impl<K, V, S> Freeze for HashMap<K, V, S>where
S: Freeze,
impl<K, V, S> RefUnwindSafe for HashMap<K, V, S>
impl<K, V, S> Unpin for HashMap<K, V, S>where
S: Unpin,
impl<K, V, S> UnwindSafe for HashMap<K, V, S>
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