pub struct SharedMap<K: Eq + Clone + Hash, V>(/* private fields */);Expand description
Concurrent map wrapper over DashMap providing ergonomic scoped access.
Implementations§
Sourcepub fn with<F, R>(&self, key: &K, f: F) -> Option<R>
pub fn with<F, R>(&self, key: &K, f: F) -> Option<R>
Read a value for a key using a closure.
Caution: f runs while the entry guard is held. Avoid re-entering this
SharedMap from inside the closure.
Sourcepub fn with_mut<F, R>(&self, key: &K, f: F) -> Option<R>
pub fn with_mut<F, R>(&self, key: &K, f: F) -> Option<R>
Mutate a value for a key using a closure.
Caution: f runs while the entry guard is held. Avoid re-entering this
SharedMap from inside the closure.
Sourcepub fn for_each<F, Ret>(&self, f: F)
pub fn for_each<F, Ret>(&self, f: F)
Iterate over all entries immutably.
Caution: f runs while an iterator entry guard is held. Avoid
re-entering this SharedMap from inside the closure.
Sourcepub fn for_each_mut<F, Ret>(&self, f: F)
pub fn for_each_mut<F, Ret>(&self, f: F)
Iterate over all entries mutably.
Caution: f runs while an iterator entry guard is held. Avoid
re-entering this SharedMap from inside the closure.
Sourcepub fn try_for_each_mut<F, E>(&self, f: F) -> Result<(), E>
pub fn try_for_each_mut<F, E>(&self, f: F) -> Result<(), E>
Fallible mutable iteration over all entries.
Caution: f runs while an iterator entry guard is held. Avoid
re-entering this SharedMap from inside the closure.
Sourcepub fn try_for_each<F, E>(&self, f: F) -> Result<(), E>
pub fn try_for_each<F, E>(&self, f: F) -> Result<(), E>
Fallible iteration over all entries.
Caution: f runs while an iterator entry guard is held. Avoid
re-entering this SharedMap from inside the closure.
Sourcepub fn contains_key(&self, key: &K) -> bool
pub fn contains_key(&self, key: &K) -> bool
Check if a key exists.