Struct sharded::map::Map [−][src]
pub struct Map<K, V, S = RandomState> { /* fields omitted */ }
Expand description
Sharded, lock-based hash map using the crate default lock
Implementations
Create a new map with the provided capacity. This will distribute the capacity evenly among all the shards (well.. see below)
pub fn with_capacity_and_hasher(
capacity: usize,
hash_builder: RandomState
) -> Self where
K: Debug,
V: Debug,
pub fn with_capacity_and_hasher(
capacity: usize,
hash_builder: RandomState
) -> Self where
K: Debug,
V: Debug,
Create a new map with the provided capacity and hash_builder. This will distribute the capacity evenly among all the shards (well.. see below)
Get a read guard to the shard corresponding to the provided key
Panics if the shard lock is poisoned
Attempt to retrieve a read guard for the shard corresponding to the provided key. If
a writer currently holds the lock, this will return an Err(WouldBlock)
Panics if the shard lock is poisoned
Does the map contain the provided key
Returns a cloned value corresponding to the provided key
Get a read guard to the shard corresponding to the provided key
Panics if the shard lock is poisoned
Insert a key value pair into the Map. Returns the existing value at the provided key if there was one.
Remove using the provided key. Returns the existing value, if any.
Creates a consuming iterator, that is, one that moves each key-value pair out of the map in arbitrary order. The map cannot be used after calling this.
pub fn into_values(self) -> IntoValues<K, V>ⓘNotable traits for IntoValues<K, V>impl<K, V> Iterator for IntoValues<K, V> type Item = V;
pub fn into_values(self) -> IntoValues<K, V>ⓘNotable traits for IntoValues<K, V>impl<K, V> Iterator for IntoValues<K, V> type Item = V;
impl<K, V> Iterator for IntoValues<K, V> type Item = V;
Creates a consuming iterator, that is, one that moves each key-value pair out of the map in arbitrary order. The map cannot be used after calling this. Yields the values of the map.