Struct storage_map::StorageMap [−][src]
pub struct StorageMap<L, M> { /* fields omitted */ }
StorageMap
is a wrapper around HashMap
that allows efficient concurrent
access for the use case when only rarely the missing elements need to be created.
Methods
impl<L, K, V, S> StorageMap<L, HashMap<K, V, S>> where
L: RawRwLock,
K: Clone + Eq + Hash,
S: BuildHasher,
[src]
impl<L, K, V, S> StorageMap<L, HashMap<K, V, S>> where
L: RawRwLock,
K: Clone + Eq + Hash,
S: BuildHasher,
pub fn with_hasher(hash_builder: S) -> Self
[src]
pub fn with_hasher(hash_builder: S) -> Self
Create a new storage map with the given hasher.
pub fn get_or_create_with<'a, F: FnOnce() -> V>(
&'a self,
key: &K,
create_fn: F
) -> StorageMapGuard<'a, L, V>
[src]
pub fn get_or_create_with<'a, F: FnOnce() -> V>(
&'a self,
key: &K,
create_fn: F
) -> StorageMapGuard<'a, L, V>
Get a value associated with the key. The method assumes that more often then not the value is already there. If it's not - the closure will be called to create one. This closure is expected to always produce the same value given the same key.
pub fn prepare_maybe<F: FnOnce() -> Option<V>>(
&self,
key: &K,
create_fn: F
) -> PrepareResult
[src]
pub fn prepare_maybe<F: FnOnce() -> Option<V>>(
&self,
key: &K,
create_fn: F
) -> PrepareResult
Make sure the given key is in the map, as a way to warm up future run-time access to the map at the initialization stage.
Trait Implementations
impl<L: Send, M> Send for StorageMap<L, M>
[src]
impl<L: Send, M> Send for StorageMap<L, M>
impl<L: Sync, M> Sync for StorageMap<L, M>
[src]
impl<L: Sync, M> Sync for StorageMap<L, M>
impl<L: RawRwLock, M: Default> Default for StorageMap<L, M>
[src]
impl<L: RawRwLock, M: Default> Default for StorageMap<L, M>
impl<L, M: Debug> Debug for StorageMap<L, M>
[src]
impl<L, M: Debug> Debug for StorageMap<L, M>