(function() { var type_impls = Object.fromEntries([["intern",[["
§

impl<K, V, S> Clone for DashMap<K, V, S>
where\n K: Eq + Hash + Clone,\n V: Clone,\n S: Clone,

§

fn clone(&self) -> DashMap<K, V, S>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
","Clone","intern::intern::InternMap","intern::intern_slice::InternMap","intern::symbol::Map"],["
§

impl<'a, K, V, S> DashMap<K, V, S>
where\n K: 'a + Eq + Hash,\n V: 'a,\n S: BuildHasher + Clone,

pub fn into_read_only(self) -> ReadOnlyView<K, V, S>

Wraps this DashMap into a read-only view. This view allows to obtain raw references to the stored values.

\n

pub fn with_hasher(hasher: S) -> DashMap<K, V, S>

Creates a new DashMap with a capacity of 0 and the provided hasher.

\n
§Examples
\n
use dashmap::DashMap;\nuse std::collections::hash_map::RandomState;\n\nlet s = RandomState::new();\nlet reviews = DashMap::with_hasher(s);\nreviews.insert(\"Veloren\", \"What a fantastic game!\");

pub fn with_capacity_and_hasher(capacity: usize, hasher: S) -> DashMap<K, V, S>

Creates a new DashMap with a specified starting capacity and hasher.

\n
§Examples
\n
use dashmap::DashMap;\nuse std::collections::hash_map::RandomState;\n\nlet s = RandomState::new();\nlet mappings = DashMap::with_capacity_and_hasher(2, s);\nmappings.insert(2, 4);\nmappings.insert(8, 16);

pub fn with_hasher_and_shard_amount(\n hasher: S,\n shard_amount: usize,\n) -> DashMap<K, V, S>

Creates a new DashMap with a specified hasher and shard amount

\n

shard_amount should be greater than 0 and a power of two.\nIf a shard_amount which is not a power of two is provided, the function will panic.

\n
§Examples
\n
use dashmap::DashMap;\nuse std::collections::hash_map::RandomState;\n\nlet s = RandomState::new();\nlet mappings = DashMap::with_hasher_and_shard_amount(s, 32);\nmappings.insert(2, 4);\nmappings.insert(8, 16);

pub fn with_capacity_and_hasher_and_shard_amount(\n capacity: usize,\n hasher: S,\n shard_amount: usize,\n) -> DashMap<K, V, S>

Creates a new DashMap with a specified starting capacity, hasher and shard_amount.

\n

shard_amount should greater than 0 and be a power of two.\nIf a shard_amount which is not a power of two is provided, the function will panic.

\n
§Examples
\n
use dashmap::DashMap;\nuse std::collections::hash_map::RandomState;\n\nlet s = RandomState::new();\nlet mappings = DashMap::with_capacity_and_hasher_and_shard_amount(2, s, 32);\nmappings.insert(2, 4);\nmappings.insert(8, 16);

pub fn hash_usize<T>(&self, item: &T) -> usize
where\n T: Hash,

Hash a given item to produce a usize.\nUses the provided or default HashBuilder.

\n

pub fn shards(\n &self,\n) -> &[CachePadded<RwLock<RawRwLock, RawTable<(K, SharedValue<V>)>>>]

Allows you to peek at the inner shards that store your data.\nYou should probably not use this unless you know what you are doing.

\n

Requires the raw-api feature to be enabled.

\n
§Examples
\n
use dashmap::DashMap;\n\nlet map = DashMap::<(), ()>::new();\nprintln!(\"Amount of shards: {}\", map.shards().len());

pub fn shards_mut(\n &mut self,\n) -> &mut [CachePadded<RwLock<RawRwLock, RawTable<(K, SharedValue<V>)>>>]

Provides mutable access to the inner shards that store your data.\nYou should probably not use this unless you know what you are doing.

\n

Requires the raw-api feature to be enabled.

\n
§Examples
\n
use dashmap::DashMap;\nuse dashmap::SharedValue;\nuse std::hash::{Hash, Hasher, BuildHasher};\n\nlet mut map = DashMap::<i32, &'static str>::new();\nlet shard_ind = map.determine_map(&42);\nlet mut factory = map.hasher().clone();\nlet hasher = |tuple: &(i32, SharedValue<&'static str>)| {\n    let mut hasher = factory.build_hasher();\n    tuple.0.hash(&mut hasher);\n    hasher.finish()\n};\nlet data = (42, SharedValue::new(\"forty two\"));\nlet hash = hasher(&data);\nmap.shards_mut()[shard_ind].get_mut().insert(hash, data, hasher);\nassert_eq!(*map.get(&42).unwrap(), \"forty two\");

pub fn into_shards(\n self,\n) -> Box<[CachePadded<RwLock<RawRwLock, RawTable<(K, SharedValue<V>)>>>]>

Consumes this DashMap and returns the inner shards.\nYou should probably not use this unless you know what you are doing.

\n

Requires the raw-api feature to be enabled.

\n

See [DashMap::shards()] and [DashMap::shards_mut()] for more information.

\n

pub fn determine_map<Q>(&self, key: &Q) -> usize
where\n K: Borrow<Q>,\n Q: Hash + Eq + ?Sized,

Finds which shard a certain key is stored in.\nYou should probably not use this unless you know what you are doing.\nNote that shard selection is dependent on the default or provided HashBuilder.

\n

Requires the raw-api feature to be enabled.

\n
§Examples
\n
use dashmap::DashMap;\n\nlet map = DashMap::new();\nmap.insert(\"coca-cola\", 1.4);\nprintln!(\"coca-cola is stored in shard: {}\", map.determine_map(\"coca-cola\"));

pub fn determine_shard(&self, hash: usize) -> usize

Finds which shard a certain hash is stored in.

\n

Requires the raw-api feature to be enabled.

\n
§Examples
\n
use dashmap::DashMap;\n\nlet map: DashMap<i32, i32> = DashMap::new();\nlet key = \"key\";\nlet hash = map.hash_usize(&key);\nprintln!(\"hash is stored in shard: {}\", map.determine_shard(hash));

pub fn hasher(&self) -> &S

Returns a reference to the map’s BuildHasher.

\n
§Examples
\n
use dashmap::DashMap;\nuse std::collections::hash_map::RandomState;\n\nlet hasher = RandomState::new();\nlet map: DashMap<i32, i32> = DashMap::new();\nlet hasher: &RandomState = map.hasher();

pub fn insert(&self, key: K, value: V) -> Option<V>

Inserts a key and a value into the map. Returns the old value associated with the key if there was one.

\n

Locking behaviour: May deadlock if called when holding any sort of reference into the map.

\n
§Examples
\n
use dashmap::DashMap;\n\nlet map = DashMap::new();\nmap.insert(\"I am the key!\", \"And I am the value!\");

pub fn remove<Q>(&self, key: &Q) -> Option<(K, V)>
where\n K: Borrow<Q>,\n Q: Hash + Eq + ?Sized,

Removes an entry from the map, returning the key and value if they existed in the map.

\n

Locking behaviour: May deadlock if called when holding any sort of reference into the map.

\n
§Examples
\n
use dashmap::DashMap;\n\nlet soccer_team = DashMap::new();\nsoccer_team.insert(\"Jack\", \"Goalie\");\nassert_eq!(soccer_team.remove(\"Jack\").unwrap().1, \"Goalie\");

pub fn remove_if<Q>(\n &self,\n key: &Q,\n f: impl FnOnce(&K, &V) -> bool,\n) -> Option<(K, V)>
where\n K: Borrow<Q>,\n Q: Hash + Eq + ?Sized,

Removes an entry from the map, returning the key and value\nif the entry existed and the provided conditional function returned true.

\n

Locking behaviour: May deadlock if called when holding any sort of reference into the map.

\n\n
use dashmap::DashMap;\n\nlet soccer_team = DashMap::new();\nsoccer_team.insert(\"Sam\", \"Forward\");\nsoccer_team.remove_if(\"Sam\", |_, position| position == &\"Goalie\");\nassert!(soccer_team.contains_key(\"Sam\"));
\n
use dashmap::DashMap;\n\nlet soccer_team = DashMap::new();\nsoccer_team.insert(\"Sam\", \"Forward\");\nsoccer_team.remove_if(\"Sam\", |_, position| position == &\"Forward\");\nassert!(!soccer_team.contains_key(\"Sam\"));

pub fn remove_if_mut<Q>(\n &self,\n key: &Q,\n f: impl FnOnce(&K, &mut V) -> bool,\n) -> Option<(K, V)>
where\n K: Borrow<Q>,\n Q: Hash + Eq + ?Sized,

pub fn iter(&'a self) -> Iter<'a, K, V, S>

Creates an iterator over a DashMap yielding immutable references.

\n

Locking behaviour: May deadlock if called when holding a mutable reference into the map.

\n
§Examples
\n
use dashmap::DashMap;\n\nlet words = DashMap::new();\nwords.insert(\"hello\", \"world\");\nassert_eq!(words.iter().count(), 1);

pub fn iter_mut(&'a self) -> IterMut<'a, K, V, S>

Iterator over a DashMap yielding mutable references.

\n

Locking behaviour: May deadlock if called when holding any sort of reference into the map.

\n
§Examples
\n
use dashmap::DashMap;\n\nlet map = DashMap::new();\nmap.insert(\"Johnny\", 21);\nmap.iter_mut().for_each(|mut r| *r += 1);\nassert_eq!(*map.get(\"Johnny\").unwrap(), 22);

pub fn get<Q>(&'a self, key: &Q) -> Option<Ref<'a, K, V>>
where\n K: Borrow<Q>,\n Q: Hash + Eq + ?Sized,

Get an immutable reference to an entry in the map

\n

Locking behaviour: May deadlock if called when holding a mutable reference into the map.

\n
§Examples
\n
use dashmap::DashMap;\n\nlet youtubers = DashMap::new();\nyoutubers.insert(\"Bosnian Bill\", 457000);\nassert_eq!(*youtubers.get(\"Bosnian Bill\").unwrap(), 457000);

pub fn get_mut<Q>(&'a self, key: &Q) -> Option<RefMut<'a, K, V>>
where\n K: Borrow<Q>,\n Q: Hash + Eq + ?Sized,

Get a mutable reference to an entry in the map

\n

Locking behaviour: May deadlock if called when holding any sort of reference into the map.

\n
§Examples
\n
use dashmap::DashMap;\n\nlet class = DashMap::new();\nclass.insert(\"Albin\", 15);\n*class.get_mut(\"Albin\").unwrap() -= 1;\nassert_eq!(*class.get(\"Albin\").unwrap(), 14);

pub fn try_get<Q>(&'a self, key: &Q) -> TryResult<Ref<'a, K, V>>
where\n K: Borrow<Q>,\n Q: Hash + Eq + ?Sized,

Get an immutable reference to an entry in the map, if the shard is not locked.\nIf the shard is locked, the function will return [TryResult::Locked].

\n
§Examples
\n
use dashmap::DashMap;\nuse dashmap::try_result::TryResult;\n\nlet map = DashMap::new();\nmap.insert(\"Johnny\", 21);\n\nassert_eq!(*map.try_get(\"Johnny\").unwrap(), 21);\n\nlet _result1_locking = map.get_mut(\"Johnny\");\n\nlet result2 = map.try_get(\"Johnny\");\nassert!(result2.is_locked());

pub fn try_get_mut<Q>(&'a self, key: &Q) -> TryResult<RefMut<'a, K, V>>
where\n K: Borrow<Q>,\n Q: Hash + Eq + ?Sized,

Get a mutable reference to an entry in the map, if the shard is not locked.\nIf the shard is locked, the function will return [TryResult::Locked].

\n
§Examples
\n
use dashmap::DashMap;\nuse dashmap::try_result::TryResult;\n\nlet map = DashMap::new();\nmap.insert(\"Johnny\", 21);\n\n*map.try_get_mut(\"Johnny\").unwrap() += 1;\nassert_eq!(*map.get(\"Johnny\").unwrap(), 22);\n\nlet _result1_locking = map.get(\"Johnny\");\n\nlet result2 = map.try_get_mut(\"Johnny\");\nassert!(result2.is_locked());

pub fn shrink_to_fit(&self)

Remove excess capacity to reduce memory usage.

\n

Locking behaviour: May deadlock if called when holding any sort of reference into the map.

\n
§Examples
\n
use dashmap::DashMap;\nuse dashmap::try_result::TryResult;\n\nlet map = DashMap::new();\nmap.insert(\"Johnny\", 21);\nassert!(map.capacity() > 0);\nmap.remove(\"Johnny\");\nmap.shrink_to_fit();\nassert_eq!(map.capacity(), 0);

pub fn retain(&self, f: impl FnMut(&K, &mut V) -> bool)

Retain elements that whose predicates return true\nand discard elements whose predicates return false.

\n

Locking behaviour: May deadlock if called when holding any sort of reference into the map.

\n
§Examples
\n
use dashmap::DashMap;\n\nlet people = DashMap::new();\npeople.insert(\"Albin\", 15);\npeople.insert(\"Jones\", 22);\npeople.insert(\"Charlie\", 27);\npeople.retain(|_, v| *v > 20);\nassert_eq!(people.len(), 2);

pub fn len(&self) -> usize

Fetches the total number of key-value pairs stored in the map.

\n

Locking behaviour: May deadlock if called when holding a mutable reference into the map.

\n
§Examples
\n
use dashmap::DashMap;\n\nlet people = DashMap::new();\npeople.insert(\"Albin\", 15);\npeople.insert(\"Jones\", 22);\npeople.insert(\"Charlie\", 27);\nassert_eq!(people.len(), 3);

pub fn is_empty(&self) -> bool

Checks if the map is empty or not.

\n

Locking behaviour: May deadlock if called when holding a mutable reference into the map.

\n
§Examples
\n
use dashmap::DashMap;\n\nlet map = DashMap::<(), ()>::new();\nassert!(map.is_empty());

pub fn clear(&self)

Removes all key-value pairs in the map.

\n

Locking behaviour: May deadlock if called when holding any sort of reference into the map.

\n
§Examples
\n
use dashmap::DashMap;\n\nlet stats = DashMap::new();\nstats.insert(\"Goals\", 4);\nassert!(!stats.is_empty());\nstats.clear();\nassert!(stats.is_empty());

pub fn capacity(&self) -> usize

Returns how many key-value pairs the map can store without reallocating.

\n

Locking behaviour: May deadlock if called when holding a mutable reference into the map.

\n

pub fn alter<Q>(&self, key: &Q, f: impl FnOnce(&K, V) -> V)
where\n K: Borrow<Q>,\n Q: Hash + Eq + ?Sized,

Modify a specific value according to a function.

\n

Locking behaviour: May deadlock if called when holding any sort of reference into the map.

\n
§Examples
\n
use dashmap::DashMap;\n\nlet stats = DashMap::new();\nstats.insert(\"Goals\", 4);\nstats.alter(\"Goals\", |_, v| v * 2);\nassert_eq!(*stats.get(\"Goals\").unwrap(), 8);
§Panics
\n

If the given closure panics, then alter will abort the process

\n

pub fn alter_all(&self, f: impl FnMut(&K, V) -> V)

Modify every value in the map according to a function.

\n

Locking behaviour: May deadlock if called when holding any sort of reference into the map.

\n
§Examples
\n
use dashmap::DashMap;\n\nlet stats = DashMap::new();\nstats.insert(\"Wins\", 4);\nstats.insert(\"Losses\", 2);\nstats.alter_all(|_, v| v + 1);\nassert_eq!(*stats.get(\"Wins\").unwrap(), 5);\nassert_eq!(*stats.get(\"Losses\").unwrap(), 3);
§Panics
\n

If the given closure panics, then alter_all will abort the process

\n

pub fn view<Q, R>(&self, key: &Q, f: impl FnOnce(&K, &V) -> R) -> Option<R>
where\n K: Borrow<Q>,\n Q: Hash + Eq + ?Sized,

Scoped access into an item of the map according to a function.

\n

Locking behaviour: May deadlock if called when holding any sort of reference into the map.

\n
§Examples
\n
use dashmap::DashMap;\n\nlet warehouse = DashMap::new();\nwarehouse.insert(4267, (\"Banana\", 100));\nwarehouse.insert(2359, (\"Pear\", 120));\nlet fruit = warehouse.view(&4267, |_k, v| *v);\nassert_eq!(fruit, Some((\"Banana\", 100)));
§Panics
\n

If the given closure panics, then view will abort the process

\n

pub fn contains_key<Q>(&self, key: &Q) -> bool
where\n K: Borrow<Q>,\n Q: Hash + Eq + ?Sized,

Checks if the map contains a specific key.

\n

Locking behaviour: May deadlock if called when holding a mutable reference into the map.

\n
§Examples
\n
use dashmap::DashMap;\n\nlet team_sizes = DashMap::new();\nteam_sizes.insert(\"Dakota Cherries\", 23);\nassert!(team_sizes.contains_key(\"Dakota Cherries\"));

pub fn entry(&'a self, key: K) -> Entry<'a, K, V>

Advanced entry API that tries to mimic std::collections::HashMap.\nSee the documentation on dashmap::mapref::entry for more details.

\n

Locking behaviour: May deadlock if called when holding any sort of reference into the map.

\n

pub fn try_entry(&'a self, key: K) -> Option<Entry<'a, K, V>>

Advanced entry API that tries to mimic std::collections::HashMap.\nSee the documentation on dashmap::mapref::entry for more details.

\n

Returns None if the shard is currently locked.

\n

pub fn try_reserve(&mut self, additional: usize) -> Result<(), TryReserveError>

Advanced entry API that tries to mimic std::collections::HashMap::try_reserve.\nTries to reserve capacity for at least shard * additional\nand may reserve more space to avoid frequent reallocations.

\n
§Errors
\n

If the capacity overflows, or the allocator reports a failure, then an error is returned.

\n
",0,"intern::intern::InternMap","intern::intern_slice::InternMap","intern::symbol::Map"],["
§

impl<K, V, S> Debug for DashMap<K, V, S>
where\n K: Eq + Hash + Debug,\n V: Debug,\n S: BuildHasher + Clone,

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
","Debug","intern::intern::InternMap","intern::intern_slice::InternMap","intern::symbol::Map"],["
§

impl<K, V, S> Default for DashMap<K, V, S>
where\n K: Eq + Hash,\n S: Default + BuildHasher + Clone,

§

fn default() -> DashMap<K, V, S>

Returns the “default value” for a type. Read more
","Default","intern::intern::InternMap","intern::intern_slice::InternMap","intern::symbol::Map"],["
§

impl<K, V, S> Extend<(K, V)> for DashMap<K, V, S>
where\n K: Eq + Hash,\n S: BuildHasher + Clone,

§

fn extend<I>(&mut self, intoiter: I)
where\n I: IntoIterator<Item = (K, V)>,

Extends a collection with the contents of an iterator. Read more
Source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
Source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
","Extend<(K, V)>","intern::intern::InternMap","intern::intern_slice::InternMap","intern::symbol::Map"],["
§

impl<K, V, S> FromIterator<(K, V)> for DashMap<K, V, S>
where\n K: Eq + Hash,\n S: BuildHasher + Clone + Default,

§

fn from_iter<I>(intoiter: I) -> DashMap<K, V, S>
where\n I: IntoIterator<Item = (K, V)>,

Creates a value from an iterator. Read more
","FromIterator<(K, V)>","intern::intern::InternMap","intern::intern_slice::InternMap","intern::symbol::Map"],["
§

impl<K, V, S> IntoIterator for DashMap<K, V, S>
where\n K: Eq + Hash,\n S: BuildHasher + Clone,

§

type Item = (K, V)

The type of the elements being iterated over.
§

type IntoIter = OwningIter<K, V, S>

Which kind of iterator are we turning this into?
§

fn into_iter(self) -> <DashMap<K, V, S> as IntoIterator>::IntoIter

Creates an iterator from a value. Read more
","IntoIterator","intern::intern::InternMap","intern::intern_slice::InternMap","intern::symbol::Map"],["
§

impl<'a, K, V, S> Map<'a, K, V, S> for DashMap<K, V, S>
where\n K: 'a + Eq + Hash,\n V: 'a,\n S: 'a + BuildHasher + Clone,

§

fn _shard_count(&self) -> usize

§

unsafe fn _get_read_shard(\n &'a self,\n i: usize,\n) -> &'a RawTable<(K, SharedValue<V>)>

Safety Read more
§

unsafe fn _yield_read_shard(\n &'a self,\n i: usize,\n) -> RwLockReadGuard<'a, RawRwLock, RawTable<(K, SharedValue<V>)>>

Safety Read more
§

unsafe fn _yield_write_shard(\n &'a self,\n i: usize,\n) -> RwLockWriteGuard<'a, RawRwLock, RawTable<(K, SharedValue<V>)>>

Safety Read more
§

unsafe fn _try_yield_read_shard(\n &'a self,\n i: usize,\n) -> Option<RwLockReadGuard<'a, RawRwLock, RawTable<(K, SharedValue<V>)>>>

Safety Read more
§

unsafe fn _try_yield_write_shard(\n &'a self,\n i: usize,\n) -> Option<RwLockWriteGuard<'a, RawRwLock, RawTable<(K, SharedValue<V>)>>>

Safety Read more
§

fn _insert(&self, key: K, value: V) -> Option<V>

§

fn _remove<Q>(&self, key: &Q) -> Option<(K, V)>
where\n K: Borrow<Q>,\n Q: Hash + Eq + ?Sized,

§

fn _remove_if<Q>(\n &self,\n key: &Q,\n f: impl FnOnce(&K, &V) -> bool,\n) -> Option<(K, V)>
where\n K: Borrow<Q>,\n Q: Hash + Eq + ?Sized,

§

fn _remove_if_mut<Q>(\n &self,\n key: &Q,\n f: impl FnOnce(&K, &mut V) -> bool,\n) -> Option<(K, V)>
where\n K: Borrow<Q>,\n Q: Hash + Eq + ?Sized,

§

fn _iter(&'a self) -> Iter<'a, K, V, S>

§

fn _iter_mut(&'a self) -> IterMut<'a, K, V, S>

§

fn _get<Q>(&'a self, key: &Q) -> Option<Ref<'a, K, V>>
where\n K: Borrow<Q>,\n Q: Hash + Eq + ?Sized,

§

fn _get_mut<Q>(&'a self, key: &Q) -> Option<RefMut<'a, K, V>>
where\n K: Borrow<Q>,\n Q: Hash + Eq + ?Sized,

§

fn _try_get<Q>(&'a self, key: &Q) -> TryResult<Ref<'a, K, V>>
where\n K: Borrow<Q>,\n Q: Hash + Eq + ?Sized,

§

fn _try_get_mut<Q>(&'a self, key: &Q) -> TryResult<RefMut<'a, K, V>>
where\n K: Borrow<Q>,\n Q: Hash + Eq + ?Sized,

§

fn _shrink_to_fit(&self)

§

fn _retain(&self, f: impl FnMut(&K, &mut V) -> bool)

§

fn _len(&self) -> usize

§

fn _capacity(&self) -> usize

§

fn _alter<Q>(&self, key: &Q, f: impl FnOnce(&K, V) -> V)
where\n K: Borrow<Q>,\n Q: Hash + Eq + ?Sized,

§

fn _alter_all(&self, f: impl FnMut(&K, V) -> V)

§

fn _view<Q, R>(&self, key: &Q, f: impl FnOnce(&K, &V) -> R) -> Option<R>
where\n K: Borrow<Q>,\n Q: Hash + Eq + ?Sized,

§

fn _entry(&'a self, key: K) -> Entry<'a, K, V>

§

fn _try_entry(&'a self, key: K) -> Option<Entry<'a, K, V>>

§

fn _hasher(&self) -> S

§

fn _clear(&self)

§

fn _contains_key<Q>(&'a self, key: &Q) -> bool
where\n K: Borrow<Q>,\n Q: Hash + Eq + ?Sized,

§

fn _is_empty(&self) -> bool

","Map<'a, K, V, S>","intern::intern::InternMap","intern::intern_slice::InternMap","intern::symbol::Map"]]]]); if (window.register_type_impls) { window.register_type_impls(type_impls); } else { window.pending_type_impls = type_impls; } })() //{"start":55,"fragment_lengths":[88492]}