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 const fn new() -> SharedStateMap<K, V>
pub const fn new() -> SharedStateMap<K, V>
Creates a new, empty SharedStateMap.
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>(&self, k: &K, init: Fn) -> SharedState<V>
pub fn get_or_init<Fn>(&self, k: &K, init: Fn) -> SharedState<V>
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§
Source§fn default() -> SharedStateMap<K, V>
fn default() -> SharedStateMap<K, V>
Returns the “default value” for a type. Read more
Auto Trait Implementations§
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more