pub struct DynamicRcuHashMap<K, V, S = RapidBuildHasher>where
K: Eq + Hash + Clone + RcuDroppable + Sync,
V: Clone + RcuDroppable + Sync,
S: BuildHasher + Send + Sync + 'static,{ /* private fields */ }Expand description
A concurrent hash map that uses RCU for read synchronization and a mutex with a dynamically specified lock level for write synchronization.
Implementations§
Source§impl<K, V> DynamicRcuHashMap<K, V, RapidBuildHasher>
impl<K, V> DynamicRcuHashMap<K, V, RapidBuildHasher>
Source§impl<K, V, S> DynamicRcuHashMap<K, V, S>where
K: Eq + Hash + Clone + RcuDroppable + Sync,
V: Clone + RcuDroppable + Sync,
S: BuildHasher + Send + Sync + 'static,
impl<K, V, S> DynamicRcuHashMap<K, V, S>where
K: Eq + Hash + Clone + RcuDroppable + Sync,
V: Clone + RcuDroppable + Sync,
S: BuildHasher + Send + Sync + 'static,
Sourcepub fn with_capacity_and_hasher<L: LockLevel>(
capacity: usize,
hash_builder: S,
) -> Self
pub fn with_capacity_and_hasher<L: LockLevel>( capacity: usize, hash_builder: S, ) -> Self
Creates a new hash map with the given capacity, hasher, and LockDep lock level.
Sourcepub fn with_hasher<L: LockLevel>(hash_builder: S) -> Self
pub fn with_hasher<L: LockLevel>(hash_builder: S) -> Self
Creates a new hash map with the given hasher and LockDep lock level.
Sourcepub fn get<'a, Q>(&self, scope: &'a RcuReadScope, key: &Q) -> Option<&'a V>
pub fn get<'a, Q>(&self, scope: &'a RcuReadScope, key: &Q) -> Option<&'a V>
Returns a reference to the value associated with the given key, if it exists.
The returned reference is bound to the lifetime of the RcuReadScope.
Sourcepub fn lock(&self) -> RcuHashMapGuard<'_, K, V, S>
pub fn lock(&self) -> RcuHashMapGuard<'_, K, V, S>
Locks the map for exclusive access, returning a guard that allows mutation.
Sourcepub fn insert(&self, key: K, value: V) -> Option<V>
pub fn insert(&self, key: K, value: V) -> Option<V>
Inserts a key-value pair into the map, returning the old value if the key was already present.
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 if the key was present.
Sourcepub fn iter<'a>(
&'a self,
scope: &'a RcuReadScope,
) -> impl Iterator<Item = (&'a K, &'a V)>
pub fn iter<'a>( &'a self, scope: &'a RcuReadScope, ) -> impl Iterator<Item = (&'a K, &'a V)>
Returns an iterator over the map’s entries.
Sourcepub fn keys<'a>(
&'a self,
scope: &'a RcuReadScope,
) -> impl Iterator<Item = &'a K>
pub fn keys<'a>( &'a self, scope: &'a RcuReadScope, ) -> impl Iterator<Item = &'a K>
Returns an iterator over the map’s keys.
Sourcepub fn values<'a>(
&'a self,
scope: &'a RcuReadScope,
) -> impl Iterator<Item = &'a V>
pub fn values<'a>( &'a self, scope: &'a RcuReadScope, ) -> impl Iterator<Item = &'a V>
Returns an iterator over the map’s values.
Trait Implementations§
Source§impl<K, V, S> Debug for DynamicRcuHashMap<K, V, S>where
K: Eq + Hash + Debug + Clone + RcuDroppable + Sync,
V: Debug + Clone + RcuDroppable + Sync,
S: BuildHasher + Send + Sync + 'static,
impl<K, V, S> Debug for DynamicRcuHashMap<K, V, S>where
K: Eq + Hash + Debug + Clone + RcuDroppable + Sync,
V: Debug + Clone + RcuDroppable + Sync,
S: BuildHasher + Send + Sync + 'static,
Source§impl<K, V> Default for DynamicRcuHashMap<K, V, RapidBuildHasher>
impl<K, V> Default for DynamicRcuHashMap<K, V, RapidBuildHasher>
Source§impl<K, V, S> MutexLike for DynamicRcuHashMap<K, V, S>where
K: Eq + Hash + Clone + RcuDroppable + Sync,
V: Clone + RcuDroppable + Sync,
S: BuildHasher + Send + Sync + 'static,
impl<K, V, S> MutexLike for DynamicRcuHashMap<K, V, S>where
K: Eq + Hash + Clone + RcuDroppable + Sync,
V: Clone + RcuDroppable + Sync,
S: BuildHasher + Send + Sync + 'static,
type Guard<'a> = RcuHashMapGuard<'a, K, V, S> where Self: 'a
type Context = <DynamicLockDepMutex<()> as MutexLike>::Context
fn context() -> Self::Context
Source§fn lock(&self, context: &mut Self::Context) -> Self::Guard<'_>
fn lock(&self, context: &mut Self::Context) -> Self::Guard<'_>
level is the index of the locked mutex in the lock ordering.fn key(&self) -> *const ()where
Self: Sized,
impl<K, V, S> RcuDroppable for DynamicRcuHashMap<K, V, S>where
K: Eq + Hash + Clone + RcuDroppable + Sync,
V: Clone + RcuDroppable + Sync,
S: BuildHasher + Send + Sync + 'static + RcuDroppable,
RcuRawHashMap<K, V, S>: RcuDroppable,
DynamicLockDepMutex<()>: RcuDroppable,
Source§impl<K, V, S> ResetDependencies for DynamicRcuHashMap<K, V, S>where
K: Eq + Hash + Clone + RcuDroppable + Sync,
V: Clone + RcuDroppable + Sync,
S: BuildHasher + Send + Sync + 'static,
impl<K, V, S> ResetDependencies for DynamicRcuHashMap<K, V, S>where
K: Eq + Hash + Clone + RcuDroppable + Sync,
V: Clone + RcuDroppable + Sync,
S: BuildHasher + Send + Sync + 'static,
Source§unsafe fn reset_dependencies(&self)
unsafe fn reset_dependencies(&self)
Auto Trait Implementations§
impl<K, V, S = BuildHasherDefault<RapidHasher>> !Freeze for DynamicRcuHashMap<K, V, S>
impl<K, V, S = BuildHasherDefault<RapidHasher>> !RefUnwindSafe for DynamicRcuHashMap<K, V, S>
impl<K, V, S> Send for DynamicRcuHashMap<K, V, S>
impl<K, V, S> Sync for DynamicRcuHashMap<K, V, S>
impl<K, V, S> Unpin for DynamicRcuHashMap<K, V, S>
impl<K, V, S> UnsafeUnpin for DynamicRcuHashMap<K, V, S>where
S: UnsafeUnpin,
impl<K, V, S> UnwindSafe for DynamicRcuHashMap<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
§impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
§impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
§impl<F, N> FidlIntoNative<Box<N>> for Fwhere
F: FidlIntoNative<N>,
impl<F, N> FidlIntoNative<Box<N>> for Fwhere
F: FidlIntoNative<N>,
fn fidl_into_native(self) -> Box<N>
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