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)

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

Number of elements in the map

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.

Create an empty sharded map

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.

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.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.