summaryrefslogtreecommitdiffstats
path: root/vendor/dashmap
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-19 09:25:56 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-19 09:25:56 +0000
commit018c4950b9406055dec02ef0fb52f132e2bb1e2c (patch)
treea835ebdf2088ef88fa681f8fad45f09922c1ae9a /vendor/dashmap
parentAdding debian version 1.75.0+dfsg1-5. (diff)
downloadrustc-018c4950b9406055dec02ef0fb52f132e2bb1e2c.tar.xz
rustc-018c4950b9406055dec02ef0fb52f132e2bb1e2c.zip
Merging upstream version 1.76.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/dashmap')
-rw-r--r--vendor/dashmap/.cargo-checksum.json2
-rw-r--r--vendor/dashmap/Cargo.toml41
-rw-r--r--vendor/dashmap/README.md6
-rw-r--r--vendor/dashmap/rust-toolchain4
-rw-r--r--vendor/dashmap/rust-toolchain.toml4
-rw-r--r--vendor/dashmap/src/arbitrary.rs13
-rw-r--r--vendor/dashmap/src/iter.rs2
-rw-r--r--vendor/dashmap/src/lib.rs48
-rw-r--r--vendor/dashmap/src/mapref/entry.rs89
-rw-r--r--vendor/dashmap/src/mapref/one.rs14
-rw-r--r--vendor/dashmap/src/rayon/map.rs2
-rw-r--r--vendor/dashmap/src/read_only.rs28
-rw-r--r--vendor/dashmap/src/serde.rs59
-rw-r--r--vendor/dashmap/src/set.rs2
14 files changed, 290 insertions, 24 deletions
diff --git a/vendor/dashmap/.cargo-checksum.json b/vendor/dashmap/.cargo-checksum.json
index 4197ac76b..45eec83d1 100644
--- a/vendor/dashmap/.cargo-checksum.json
+++ b/vendor/dashmap/.cargo-checksum.json
@@ -1 +1 @@
-{"files":{"Cargo.toml":"8181631e0224f428c3c213850ce536d9d27c82b46e3eadcd0137f78470086fc2","LICENSE":"16692e8cee4aa06e3913787497eba2d47c42002014136f5da67be6ee640e28a3","README.md":"e1114aed5dfbd2892f2d81881c46f8e17b9b4774344ad3feb55bd2c1a41384fd","rust-toolchain":"06dc4c395690e7d6ff8b92d8d265a8cf1c02cbca414e15352072e378fcb4171a","src/iter.rs":"dec9cc68374a0a176b5840e37da4e83d0493d7dca6f776dc926bf511c84e70db","src/iter_set.rs":"5327da951dc93d30b293aeb7a805666ee4b8e6364881348ab5d86b23c29a0e13","src/lib.rs":"24935d49696b2d05a83287c6a5f08d59bc206a535bfa0f8893bfeff3cfd14ea8","src/lock.rs":"22b1013ee3cbd1598c26403552faf8e5b44fe98a8ff4c8812da15d57bdeee4b3","src/mapref/entry.rs":"ddcf788856330a4384ce987bb84ff36b494675b3b1f2460ae48376ac664491df","src/mapref/mod.rs":"15bd45cfc642a9e3e77bbfbf2d9fad9c5fac0ff6904214a3c501e262242ec8b0","src/mapref/multiple.rs":"17a87879229d78f75d71817d100aa0a210d764d6b66e4a05b17a3e092d17e306","src/mapref/one.rs":"ea46339e08c5033cf419c195e922e1ba6f606fc71c15ee31d1b3c38cfedfedcf","src/rayon/map.rs":"2df5ac8241d92e1811852abd65c5b3124a14d886ae4e3a8a5cbdfdb3d7dde929","src/rayon/read_only.rs":"99dc0083f6840f59b2090bc9c5f9767a44088832e63935cb8f6bc7eca8b86102","src/rayon/set.rs":"21fe2ca8c58c8ff1bc753f5e2eb6131afd598211eea375f2ac7190cd0f9abcba","src/read_only.rs":"d872ec78201ddc272aeeabdbeaccb26e069704b85aa2f6a4d56bd0c5defe7a2b","src/serde.rs":"57bbf2b255de966cc9c54011429495cc5308a1f76906846b29e015f860b79559","src/set.rs":"80271aa0d8a32845afdef5a35f18e5cac6f0f5ab8d2a6b11b02cd123152c91d4","src/setref/mod.rs":"cc39e406a333dc6c04398f4b1336fb400e3a8360c387466d8a91f5d7f4ed40a7","src/setref/multiple.rs":"2270749e83f80dbb4761448f0629ecd02b0b4268f76834236d1167844e6d5e37","src/setref/one.rs":"69738583f2a160f3907e540277ccd88e0036406b3ead66b3d4015ddd938d6937","src/t.rs":"9b40ebfba22369813bf159ed60fa70e742ae72bfaec6aee91a716cba91cb8f0d","src/try_result.rs":"81d1dd396f70b0aa2a6e1969851b706cbfdfb09c802ac9d33dcace882aa28dd1","src/util.rs":"7a8096a713cf04e60d6c9e38cd366314ed74472abab4bb8a3a9ed081a0e0301b"},"package":"907076dfda823b0b36d2a1bb5f90c96660a5bbcd7729e10727f07858f22c4edc"} \ No newline at end of file
+{"files":{"Cargo.toml":"c758b23fe682b4e447bc5350e1e838577ed6ec4ec8833607ff16f57f1d0495a7","LICENSE":"16692e8cee4aa06e3913787497eba2d47c42002014136f5da67be6ee640e28a3","README.md":"7f7b4edce5b4baabf639df517a66bfa2cd8ff759f09060c17fe6da54531b5819","rust-toolchain.toml":"8e14ad3424881d09f3b219e947b4b95f12726295abde287f91d10af8c5a7dd13","src/arbitrary.rs":"236abf377cbae8393961e0e4327ce2515d5aeeddfb1fabb1f2035c69dfea290c","src/iter.rs":"086a7be951241253b3ea60c64fb324aaa32742038461994e3946bdd8712ce452","src/iter_set.rs":"5327da951dc93d30b293aeb7a805666ee4b8e6364881348ab5d86b23c29a0e13","src/lib.rs":"6ec142f4ad577da1e399738a4bbcdee0baae5290d5b5274e6d295d92bcf113ba","src/lock.rs":"22b1013ee3cbd1598c26403552faf8e5b44fe98a8ff4c8812da15d57bdeee4b3","src/mapref/entry.rs":"c03777d2b863a98fea517ad97037741930c766e7cbd17aea2aab1fbf0e11c719","src/mapref/mod.rs":"15bd45cfc642a9e3e77bbfbf2d9fad9c5fac0ff6904214a3c501e262242ec8b0","src/mapref/multiple.rs":"17a87879229d78f75d71817d100aa0a210d764d6b66e4a05b17a3e092d17e306","src/mapref/one.rs":"0026aff85dd5411b5c181396b8b5b9a9cbc524720a8f409fd4aa62c1b5501146","src/rayon/map.rs":"68d541bb6c9372fe13e44f09d9fcba4f214f52f16649e326486f8976dc03cd99","src/rayon/read_only.rs":"99dc0083f6840f59b2090bc9c5f9767a44088832e63935cb8f6bc7eca8b86102","src/rayon/set.rs":"21fe2ca8c58c8ff1bc753f5e2eb6131afd598211eea375f2ac7190cd0f9abcba","src/read_only.rs":"012a6e44195125eb3c0fd028123b348f5294c7e083bf1c3c0bf8400201c35e27","src/serde.rs":"9854d44b05ebe400ef8ac8ea9c8f140e1c59870d74aaf3ccaf72e82c6dc40905","src/set.rs":"cf75d91db42d18afec314afe9a461cc6e86ddedd11ff9248ed7345780948e5e0","src/setref/mod.rs":"cc39e406a333dc6c04398f4b1336fb400e3a8360c387466d8a91f5d7f4ed40a7","src/setref/multiple.rs":"2270749e83f80dbb4761448f0629ecd02b0b4268f76834236d1167844e6d5e37","src/setref/one.rs":"69738583f2a160f3907e540277ccd88e0036406b3ead66b3d4015ddd938d6937","src/t.rs":"9b40ebfba22369813bf159ed60fa70e742ae72bfaec6aee91a716cba91cb8f0d","src/try_result.rs":"81d1dd396f70b0aa2a6e1969851b706cbfdfb09c802ac9d33dcace882aa28dd1","src/util.rs":"7a8096a713cf04e60d6c9e38cd366314ed74472abab4bb8a3a9ed081a0e0301b"},"package":"978747c1d849a7d2ee5e8adc0159961c48fb7e5db2f06af6723b80123bb53856"} \ No newline at end of file
diff --git a/vendor/dashmap/Cargo.toml b/vendor/dashmap/Cargo.toml
index ce76bd9a7..cb7480b5a 100644
--- a/vendor/dashmap/Cargo.toml
+++ b/vendor/dashmap/Cargo.toml
@@ -11,44 +11,63 @@
[package]
edition = "2018"
-rust-version = "1.59"
+rust-version = "1.65"
name = "dashmap"
-version = "5.4.0"
+version = "5.5.3"
authors = ["Acrimon <joel.wejdenstal@gmail.com>"]
description = "Blazing fast concurrent HashMap for Rust."
homepage = "https://github.com/xacrimon/dashmap"
documentation = "https://docs.rs/dashmap"
readme = "README.md"
-keywords = ["atomic", "concurrent", "hashmap"]
-categories = ["concurrency", "algorithms", "data-structures"]
+keywords = [
+ "atomic",
+ "concurrent",
+ "hashmap",
+]
+categories = [
+ "concurrency",
+ "algorithms",
+ "data-structures",
+]
license = "MIT"
repository = "https://github.com/xacrimon/dashmap"
+
[package.metadata.docs.rs]
-features = ["rayon", "raw-api", "serde"]
+features = [
+ "rayon",
+ "raw-api",
+ "serde",
+]
+
+[dependencies.arbitrary]
+version = "1.3.0"
+optional = true
+
[dependencies.cfg-if]
version = "1.0.0"
[dependencies.hashbrown]
-version = "0.12.3"
+version = "0.14.0"
default-features = false
[dependencies.lock_api]
-version = "0.4.8"
+version = "0.4.10"
[dependencies.once_cell]
-version = "1.13.1"
+version = "1.18.0"
[dependencies.parking_lot_core]
-version = "0.9.3"
+version = "0.9.8"
[dependencies.rayon]
-version = "1.5.3"
+version = "1.7.0"
optional = true
[dependencies.serde]
-version = "1.0.144"
+version = "1.0.188"
features = ["derive"]
optional = true
[features]
+inline = ["hashbrown/inline-more"]
raw-api = []
diff --git a/vendor/dashmap/README.md b/vendor/dashmap/README.md
index 580480f20..2eb721eb1 100644
--- a/vendor/dashmap/README.md
+++ b/vendor/dashmap/README.md
@@ -20,7 +20,7 @@ If you have any suggestions or tips do not hesitate to open an issue or a PR.
[![downloads](https://img.shields.io/crates/d/dashmap)](https://crates.io/crates/dashmap)
-[![minimum rustc version](https://img.shields.io/badge/rustc-1.59-orange.svg)](https://crates.io/crates/dashmap)
+[![minimum rustc version](https://img.shields.io/badge/rustc-1.65-orange.svg)](https://crates.io/crates/dashmap)
## Cargo features
@@ -30,6 +30,10 @@ If you have any suggestions or tips do not hesitate to open an issue or a PR.
- `rayon` - Enables rayon support.
+- `inline` - Enables `inline-more` feature from the `hashbrown` crate. Can lead to better performance, but with the cost of longer compile-time.
+
+- `arbitrary` - Enables support for the `arbitrary` crate.
+
## Contributing
DashMap gladly accepts contributions!
diff --git a/vendor/dashmap/rust-toolchain b/vendor/dashmap/rust-toolchain
deleted file mode 100644
index 62d03d54d..000000000
--- a/vendor/dashmap/rust-toolchain
+++ /dev/null
@@ -1,4 +0,0 @@
-[toolchain]
-channel = "1.59"
-components = [ "rustfmt", "clippy" ]
-profile = "minimal"
diff --git a/vendor/dashmap/rust-toolchain.toml b/vendor/dashmap/rust-toolchain.toml
new file mode 100644
index 000000000..a32876aa6
--- /dev/null
+++ b/vendor/dashmap/rust-toolchain.toml
@@ -0,0 +1,4 @@
+[toolchain]
+channel = "1.65"
+components = ["rustfmt", "clippy"]
+profile = "minimal"
diff --git a/vendor/dashmap/src/arbitrary.rs b/vendor/dashmap/src/arbitrary.rs
new file mode 100644
index 000000000..a760964bb
--- /dev/null
+++ b/vendor/dashmap/src/arbitrary.rs
@@ -0,0 +1,13 @@
+use arbitrary::{Arbitrary, Unstructured};
+use core::hash::BuildHasher;
+
+impl<'a, K, V, S> Arbitrary<'a> for crate::DashMap<K, V, S>
+where
+ K: Eq + std::hash::Hash + Arbitrary<'a>,
+ V: Arbitrary<'a>,
+ S: Default + BuildHasher + Clone,
+{
+ fn arbitrary(u: &mut Unstructured<'a>) -> arbitrary::Result<Self> {
+ u.arbitrary_iter()?.collect()
+ }
+}
diff --git a/vendor/dashmap/src/iter.rs b/vendor/dashmap/src/iter.rs
index cc2f12ea8..ce50e7390 100644
--- a/vendor/dashmap/src/iter.rs
+++ b/vendor/dashmap/src/iter.rs
@@ -118,7 +118,7 @@ pub struct Iter<'a, K, V, S = RandomState, M = DashMap<K, V, S>> {
current: Option<GuardIter<'a, K, V, S>>,
}
-impl<'a, 'i, K: Clone + Hash + Eq, V: Clone, S: Clone + BuildHasher> Clone for Iter<'i, K, V, S> {
+impl<'i, K: Clone + Hash + Eq, V: Clone, S: Clone + BuildHasher> Clone for Iter<'i, K, V, S> {
fn clone(&self) -> Self {
Iter::new(self.map)
}
diff --git a/vendor/dashmap/src/lib.rs b/vendor/dashmap/src/lib.rs
index bf112d570..34e5d8ba3 100644
--- a/vendor/dashmap/src/lib.rs
+++ b/vendor/dashmap/src/lib.rs
@@ -1,5 +1,7 @@
#![allow(clippy::type_complexity)]
+#[cfg(feature = "arbitrary")]
+mod arbitrary;
pub mod iter;
pub mod iter_set;
mod lock;
@@ -268,7 +270,7 @@ impl<'a, K: 'a + Eq + Hash, V: 'a, S: BuildHasher + Clone> DashMap<K, V, S> {
hasher: S,
shard_amount: usize,
) -> Self {
- assert!(shard_amount > 0);
+ assert!(shard_amount > 1);
assert!(shard_amount.is_power_of_two());
let shift = util::ptr_size_bits() - ncb(shard_amount);
@@ -318,11 +320,51 @@ impl<'a, K: 'a + Eq + Hash, V: 'a, S: BuildHasher + Clone> DashMap<K, V, S> {
pub fn shards(&self) -> &[RwLock<HashMap<K, V, S>>] {
&self.shards
}
+
+ /// Provides mutable access to the inner shards that store your data.
+ /// You should probably not use this unless you know what you are doing.
+ ///
+ /// Requires the `raw-api` feature to be enabled.
+ ///
+ /// # Examples
+ ///
+ /// ```
+ /// use dashmap::DashMap;
+ /// use dashmap::SharedValue;
+ ///
+ /// let mut map = DashMap::<i32, &'static str>::new();
+ /// let shard_ind = map.determine_map(&42);
+ /// map.shards_mut()[shard_ind].get_mut().insert(42, SharedValue::new("forty two"));
+ /// assert_eq!(*map.get(&42).unwrap(), "forty two");
+ /// ```
+ pub fn shards_mut(&mut self) -> &mut [RwLock<HashMap<K, V, S>>] {
+ &mut self.shards
+ }
+
+ /// Consumes this `DashMap` and returns the inner shards.
+ /// You should probably not use this unless you know what you are doing.
+ ///
+ /// Requires the `raw-api` feature to be enabled.
+ ///
+ /// See [`DashMap::shards()`] and [`DashMap::shards_mut()`] for more information.
+ pub fn into_shards(self) -> Box<[RwLock<HashMap<K, V, S>>]> {
+ self.shards
+ }
} else {
#[allow(dead_code)]
pub(crate) fn shards(&self) -> &[RwLock<HashMap<K, V, S>>] {
&self.shards
}
+
+ #[allow(dead_code)]
+ pub(crate) fn shards_mut(&mut self) -> &mut [RwLock<HashMap<K, V, S>>] {
+ &mut self.shards
+ }
+
+ #[allow(dead_code)]
+ pub(crate) fn into_shards(self) -> Box<[RwLock<HashMap<K, V, S>>]> {
+ self.shards
+ }
}
}
@@ -510,7 +552,7 @@ impl<'a, K: 'a + Eq + Hash, V: 'a, S: BuildHasher + Clone> DashMap<K, V, S> {
self._iter_mut()
}
- /// Get a immutable reference to an entry in the map
+ /// Get an immutable reference to an entry in the map
///
/// **Locking behaviour:** May deadlock if called when holding a mutable reference into the map.
///
@@ -1223,7 +1265,7 @@ where
}
}
-impl<'a, K: Eq + Hash, V, S: BuildHasher + Clone> IntoIterator for DashMap<K, V, S> {
+impl<K: Eq + Hash, V, S: BuildHasher + Clone> IntoIterator for DashMap<K, V, S> {
type Item = (K, V);
type IntoIter = OwningIter<K, V, S>;
diff --git a/vendor/dashmap/src/mapref/entry.rs b/vendor/dashmap/src/mapref/entry.rs
index 16a42ce77..e9e6b913a 100644
--- a/vendor/dashmap/src/mapref/entry.rs
+++ b/vendor/dashmap/src/mapref/entry.rs
@@ -82,6 +82,36 @@ impl<'a, K: Eq + Hash, V, S: BuildHasher> Entry<'a, K, V, S> {
Entry::Vacant(entry) => Ok(entry.insert(value()?)),
}
}
+
+ /// Sets the value of the entry, and returns a reference to the inserted value.
+ pub fn insert(self, value: V) -> RefMut<'a, K, V, S> {
+ match self {
+ Entry::Occupied(mut entry) => {
+ entry.insert(value);
+ entry.into_ref()
+ }
+ Entry::Vacant(entry) => entry.insert(value),
+ }
+ }
+
+ /// Sets the value of the entry, and returns an OccupiedEntry.
+ ///
+ /// If you are not interested in the occupied entry,
+ /// consider [`insert`] as it doesn't need to clone the key.
+ ///
+ /// [`insert`]: Entry::insert
+ pub fn insert_entry(self, value: V) -> OccupiedEntry<'a, K, V, S>
+ where
+ K: Clone,
+ {
+ match self {
+ Entry::Occupied(mut entry) => {
+ entry.insert(value);
+ entry
+ }
+ Entry::Vacant(entry) => entry.insert_entry(value),
+ }
+ }
}
pub struct VacantEntry<'a, K, V, S = RandomState> {
@@ -117,6 +147,22 @@ impl<'a, K: Eq + Hash, V, S: BuildHasher> VacantEntry<'a, K, V, S> {
}
}
+ /// Sets the value of the entry with the VacantEntry’s key, and returns an OccupiedEntry.
+ pub fn insert_entry(mut self, value: V) -> OccupiedEntry<'a, K, V, S>
+ where
+ K: Clone,
+ {
+ unsafe {
+ self.shard.insert(self.key.clone(), SharedValue::new(value));
+
+ let (k, v) = self.shard.get_key_value(&self.key).unwrap();
+
+ let kptr: *const K = k;
+ let vptr: *mut V = v.as_ptr();
+ OccupiedEntry::new(self.shard, self.key, (kptr, vptr))
+ }
+ }
+
pub fn into_key(self) -> K {
self.key
}
@@ -187,3 +233,46 @@ impl<'a, K: Eq + Hash, V, S: BuildHasher> OccupiedEntry<'a, K, V, S> {
(k, v.into_inner())
}
}
+
+#[cfg(test)]
+mod tests {
+ use crate::DashMap;
+
+ use super::*;
+
+ #[test]
+ fn test_insert_entry_into_vacant() {
+ let map: DashMap<u32, u32> = DashMap::new();
+
+ let entry = map.entry(1);
+
+ assert!(matches!(entry, Entry::Vacant(_)));
+
+ let entry = entry.insert_entry(2);
+
+ assert_eq!(*entry.get(), 2);
+
+ drop(entry);
+
+ assert_eq!(*map.get(&1).unwrap(), 2);
+ }
+
+ #[test]
+ fn test_insert_entry_into_occupied() {
+ let map: DashMap<u32, u32> = DashMap::new();
+
+ map.insert(1, 1000);
+
+ let entry = map.entry(1);
+
+ assert!(matches!(&entry, Entry::Occupied(entry) if *entry.get() == 1000));
+
+ let entry = entry.insert_entry(2);
+
+ assert_eq!(*entry.get(), 2);
+
+ drop(entry);
+
+ assert_eq!(*map.get(&1).unwrap(), 2);
+ }
+}
diff --git a/vendor/dashmap/src/mapref/one.rs b/vendor/dashmap/src/mapref/one.rs
index 835e45cad..fd3853096 100644
--- a/vendor/dashmap/src/mapref/one.rs
+++ b/vendor/dashmap/src/mapref/one.rs
@@ -241,6 +241,20 @@ impl<'a, K: Eq + Hash, V, T, S: BuildHasher> Deref for MappedRef<'a, K, V, T, S>
}
}
+impl<'a, K: Eq + Hash, V, T: std::fmt::Display> std::fmt::Display for MappedRef<'a, K, V, T> {
+ fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+ std::fmt::Display::fmt(self.value(), f)
+ }
+}
+
+impl<'a, K: Eq + Hash, V, T: AsRef<TDeref>, TDeref: ?Sized> AsRef<TDeref>
+ for MappedRef<'a, K, V, T>
+{
+ fn as_ref(&self) -> &TDeref {
+ self.value().as_ref()
+ }
+}
+
pub struct MappedRefMut<'a, K, V, T, S = RandomState> {
_guard: RwLockWriteGuard<'a, HashMap<K, V, S>>,
k: *const K,
diff --git a/vendor/dashmap/src/rayon/map.rs b/vendor/dashmap/src/rayon/map.rs
index 4fc0c43aa..ab45e6179 100644
--- a/vendor/dashmap/src/rayon/map.rs
+++ b/vendor/dashmap/src/rayon/map.rs
@@ -173,7 +173,7 @@ where
}
}
-impl<'a, K, V, S> DashMap<K, V, S>
+impl<K, V, S> DashMap<K, V, S>
where
K: Send + Sync + Eq + Hash,
V: Send + Sync,
diff --git a/vendor/dashmap/src/read_only.rs b/vendor/dashmap/src/read_only.rs
index 14582245b..42ee44331 100644
--- a/vendor/dashmap/src/read_only.rs
+++ b/vendor/dashmap/src/read_only.rs
@@ -1,5 +1,7 @@
+use crate::lock::RwLock;
use crate::t::Map;
use crate::{DashMap, HashMap};
+use cfg_if::cfg_if;
use core::borrow::Borrow;
use core::fmt;
use core::hash::{BuildHasher, Hash};
@@ -121,6 +123,32 @@ impl<'a, K: 'a + Eq + Hash, V: 'a, S: BuildHasher + Clone> ReadOnlyView<K, V, S>
.flat_map(|shard| shard.values())
.map(|v| v.get())
}
+
+ cfg_if! {
+ if #[cfg(feature = "raw-api")] {
+ /// Allows you to peek at the inner shards that store your data.
+ /// You should probably not use this unless you know what you are doing.
+ ///
+ /// Requires the `raw-api` feature to be enabled.
+ ///
+ /// # Examples
+ ///
+ /// ```
+ /// use dashmap::DashMap;
+ ///
+ /// let map = DashMap::<(), ()>::new().into_read_only();
+ /// println!("Amount of shards: {}", map.shards().len());
+ /// ```
+ pub fn shards(&self) -> &[RwLock<HashMap<K, V, S>>] {
+ &self.map.shards
+ }
+ } else {
+ #[allow(dead_code)]
+ pub(crate) fn shards(&self) -> &[RwLock<HashMap<K, V, S>>] {
+ &self.map.shards
+ }
+ }
+ }
}
#[cfg(test)]
diff --git a/vendor/dashmap/src/serde.rs b/vendor/dashmap/src/serde.rs
index df4fd2e48..6abeb069b 100644
--- a/vendor/dashmap/src/serde.rs
+++ b/vendor/dashmap/src/serde.rs
@@ -1,4 +1,4 @@
-use crate::{DashMap, DashSet};
+use crate::{mapref, setref, DashMap, DashSet};
use core::fmt;
use core::hash::{BuildHasher, Hash};
use core::marker::PhantomData;
@@ -156,3 +156,60 @@ where
seq.end()
}
}
+
+macro_rules! serialize_impl {
+ () => {
+ fn serialize<Ser>(&self, serializer: Ser) -> Result<Ser::Ok, Ser::Error>
+ where
+ Ser: serde::Serializer,
+ {
+ std::ops::Deref::deref(self).serialize(serializer)
+ }
+ };
+}
+
+// Map
+impl<'a, K: Eq + Hash, V: Serialize, S: BuildHasher> Serialize
+ for mapref::multiple::RefMulti<'a, K, V, S>
+{
+ serialize_impl! {}
+}
+
+impl<'a, K: Eq + Hash, V: Serialize, S: BuildHasher> Serialize
+ for mapref::multiple::RefMutMulti<'a, K, V, S>
+{
+ serialize_impl! {}
+}
+
+impl<'a, K: Eq + Hash, V: Serialize, S: BuildHasher> Serialize for mapref::one::Ref<'a, K, V, S> {
+ serialize_impl! {}
+}
+
+impl<'a, K: Eq + Hash, V: Serialize, S: BuildHasher> Serialize
+ for mapref::one::RefMut<'a, K, V, S>
+{
+ serialize_impl! {}
+}
+
+impl<'a, K: Eq + Hash, V, T: Serialize, S: BuildHasher> Serialize
+ for mapref::one::MappedRef<'a, K, V, T, S>
+{
+ serialize_impl! {}
+}
+
+impl<'a, K: Eq + Hash, V, T: Serialize, S: BuildHasher> Serialize
+ for mapref::one::MappedRefMut<'a, K, V, T, S>
+{
+ serialize_impl! {}
+}
+
+// Set
+impl<'a, V: Hash + Eq + Serialize, S: BuildHasher> Serialize
+ for setref::multiple::RefMulti<'a, V, S>
+{
+ serialize_impl! {}
+}
+
+impl<'a, V: Hash + Eq + Serialize, S: BuildHasher> Serialize for setref::one::Ref<'a, V, S> {
+ serialize_impl! {}
+}
diff --git a/vendor/dashmap/src/set.rs b/vendor/dashmap/src/set.rs
index 12445a994..1a5617706 100644
--- a/vendor/dashmap/src/set.rs
+++ b/vendor/dashmap/src/set.rs
@@ -385,7 +385,7 @@ impl<'a, K: 'a + Eq + Hash, S: BuildHasher + Clone> DashSet<K, S> {
}
}
-impl<'a, K: Eq + Hash, S: BuildHasher + Clone> IntoIterator for DashSet<K, S> {
+impl<K: Eq + Hash, S: BuildHasher + Clone> IntoIterator for DashSet<K, S> {
type Item = K;
type IntoIter = OwningIter<K, S>;