#[repr(align(128))]pub struct RawTable<K: Key + ?Sized, V> { /* private fields */ }
Expand description
A concurrent hash table.
Implementations§
Source§impl<K: Key + ?Sized, V> RawTable<K, V>
impl<K: Key + ?Sized, V> RawTable<K, V>
Sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Creates a new RawTable
that will not reallocate before capacity
insertions are done.
Sourcepub fn get(&self, hash: u64, eq: impl FnMut(&K) -> bool) -> Option<&V>
pub fn get(&self, hash: u64, eq: impl FnMut(&K) -> bool) -> Option<&V>
Finds the value corresponding to a key with the given hash and equality function.
Sourcepub fn get_or_insert_with(
&self,
hash: u64,
key: &K,
eq: impl FnMut(&K) -> bool,
val_f: impl FnOnce(&K) -> V,
) -> &V
pub fn get_or_insert_with( &self, hash: u64, key: &K, eq: impl FnMut(&K) -> bool, val_f: impl FnOnce(&K) -> V, ) -> &V
Finds the value corresponding to a key with the given hash and equality function, or insert a new one if the key does not exist.
val_f
is guaranteed to only be called when inserting a new key not currently found in the
table, even if multiple concurrent inserts occur. The key reference passed to val_f
lives
as long as the new entry will.
Sourcepub fn try_get_or_insert_with<E>(
&self,
hash: u64,
key: &K,
eq: impl FnMut(&K) -> bool,
val_f: impl FnOnce(&K) -> Result<V, E>,
) -> Result<&V, E>
pub fn try_get_or_insert_with<E>( &self, hash: u64, key: &K, eq: impl FnMut(&K) -> bool, val_f: impl FnOnce(&K) -> Result<V, E>, ) -> Result<&V, E>
Finds the value corresponding to a key with the given hash and equality function, or insert a new one if the key does not exist.
val_f
is guaranteed to only be called when inserting a new key not currently found in the
table, even if multiple concurrent inserts occur. The key reference passed to val_f
lives
as long as the new entry will.
Trait Implementations§
impl<K: Key + Send + ?Sized, V: Send> Send for RawTable<K, V>
impl<K: Key + Send + Sync + ?Sized, V: Send + Sync> Sync for RawTable<K, V>
Auto Trait Implementations§
impl<K, V> !Freeze for RawTable<K, V>
impl<K, V> RefUnwindSafe for RawTable<K, V>
impl<K, V> Unpin for RawTable<K, V>
impl<K, V> UnwindSafe for RawTable<K, V>
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<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more