pub struct HopscotchMap<K: 'static, V: 'static, S = FixedState> { /* private fields */ }Expand description
A concurrent, lock-free hash map based on Hopscotch Hashing.
Implementations§
Source§impl<K, V> HopscotchMap<K, V, FixedState>
impl<K, V> HopscotchMap<K, V, FixedState>
Sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Creates a new HopscotchMap with the specified capacity and default hasher.
Source§impl<K, V, S> HopscotchMap<K, V, S>
impl<K, V, S> HopscotchMap<K, V, S>
Sourcepub fn with_hasher(hasher: S) -> Self
pub fn with_hasher(hasher: S) -> Self
Creates a new HopscotchMap with the specified hasher and default capacity.
Sourcepub fn with_capacity_and_hasher(capacity: usize, hasher: S) -> Self
pub fn with_capacity_and_hasher(capacity: usize, hasher: S) -> Self
Creates a new HopscotchMap with the specified capacity and hasher.
Sourcepub fn get_or_insert(&self, key: K, value: V) -> V
pub fn get_or_insert(&self, key: K, value: V) -> V
Returns the value corresponding to the key, or inserts the given value if the key is not present.
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 remove<Q>(&self, key: &Q) -> Option<V>
pub fn remove<Q>(&self, key: &Q) -> Option<V>
Removes a key from the map, returning the value at the key if the key was previously in the map.
Sourcepub fn iter(&self) -> HopscotchIter<'_, K, V, S> ⓘ
pub fn iter(&self) -> HopscotchIter<'_, K, V, S> ⓘ
Returns an iterator over the map entries.
Sourcepub fn keys(&self) -> HopscotchKeys<'_, K, V, S> ⓘ
pub fn keys(&self) -> HopscotchKeys<'_, K, V, S> ⓘ
Returns an iterator over the map keys.
Trait Implementations§
Source§impl<K, V> Default for HopscotchMap<K, V, FixedState>
Available on crate feature std only.
impl<K, V> Default for HopscotchMap<K, V, FixedState>
Available on crate feature
std only.Source§impl<K, V, S> Drop for HopscotchMap<K, V, S>
impl<K, V, S> Drop for HopscotchMap<K, V, S>
Source§impl<'a, K, V, S> IntoIterator for &'a HopscotchMap<K, V, S>
impl<'a, K, V, S> IntoIterator for &'a HopscotchMap<K, V, S>
impl<K: Send, V: Send, S: Send> Send for HopscotchMap<K, V, S>
impl<K: Sync, V: Sync, S: Sync> Sync for HopscotchMap<K, V, S>
Auto Trait Implementations§
impl<K, V, S = FixedState> !Freeze for HopscotchMap<K, V, S>
impl<K, V, S> RefUnwindSafe for HopscotchMap<K, V, S>
impl<K, V, S> Unpin for HopscotchMap<K, V, S>where
S: Unpin,
impl<K, V, S> UnwindSafe for HopscotchMap<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