pub struct RcuHashMap<K, V, F = RcuDefaultFlavor>(/* private fields */)
where
K: Send + 'static,
V: Send + 'static,
F: RcuFlavor + 'static;Expand description
Defines a RCU lock-free hashmap.
This hashmap supports multiple concurrents readers and writers. It is guaranteed to never block on a call.
§Limitations
§Mutable References
Because there might always be readers borrowing a node’s data, it is impossible to get a mutable references to the data inside the stack. You should design the type stored in the stack with interior mutabillity that can be shared between threads.
§Safety
It is safe to send an Arc<RcuHashMap<T>> to a non-registered RCU thread. A
non-registered thread may drop an RcuHashMap<T> without calling any RCU
primitives since lifetime rules prevent any other thread from accessing an
RCU reference.
Implementations§
Source§impl<K, V, F> RcuHashMap<K, V, F>
impl<K, V, F> RcuHashMap<K, V, F>
Sourcepub fn insert<G>(&self, key: K, value: V, guard: &G) -> Option<Ref<K, V, F>>
pub fn insert<G>(&self, key: K, value: V, guard: &G) -> Option<Ref<K, V, F>>
Inserts a key-value pair in the hashmap.
If the hashmap did not have this key present, None is returned.
Sourcepub fn contains<G>(&self, key: &K, guard: &G) -> bool
pub fn contains<G>(&self, key: &K, guard: &G) -> bool
Returns true if the hashmap contains a value for the specified key.
Sourcepub fn get<'me, 'guard, G>(
&'me self,
key: &K,
_guard: &'guard G,
) -> Option<&'guard V>
pub fn get<'me, 'guard, G>( &'me self, key: &K, _guard: &'guard G, ) -> Option<&'guard V>
Returns a reference to the value corresponding to the key.