pub struct SharedStateMap<K, V> { /* private fields */ }Expand description
A thread-safe map that allows concurrent access to values using read-write locks.
Implementations§
Sourcepub fn get(&self, k: &K) -> Option<SharedState<V>>
pub fn get(&self, k: &K) -> Option<SharedState<V>>
Retrieves a value associated with the given key, if it exists.
Sourcepub fn get_or_init<Fn: FnMut(&K) -> V>(&self, k: &K, init: Fn) -> SharedState<V>where
K: Clone,
pub fn get_or_init<Fn: FnMut(&K) -> V>(&self, k: &K, init: Fn) -> SharedState<V>where
K: Clone,
Retrieves a value associated with the given key, or inserts a new value using the provided initializer function if the key does not exist.
Trait Implementations§
Auto Trait Implementations§
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