/rust/registry/src/index.crates.io-6f17d22bba15001f/dashmap-6.0.1/src/iter_set.rs
Line | Count | Source (jump to first uncovered line) |
1 | | use crate::setref::multiple::RefMulti; |
2 | | use crate::t::Map; |
3 | | use core::hash::{BuildHasher, Hash}; |
4 | | |
5 | | pub struct OwningIter<K, S> { |
6 | | inner: crate::iter::OwningIter<K, (), S>, |
7 | | } |
8 | | |
9 | | impl<K: Eq + Hash, S: BuildHasher + Clone> OwningIter<K, S> { |
10 | 0 | pub(crate) fn new(inner: crate::iter::OwningIter<K, (), S>) -> Self { |
11 | 0 | Self { inner } |
12 | 0 | } |
13 | | } |
14 | | |
15 | | impl<K: Eq + Hash, S: BuildHasher + Clone> Iterator for OwningIter<K, S> { |
16 | | type Item = K; |
17 | | |
18 | 0 | fn next(&mut self) -> Option<Self::Item> { |
19 | 0 | self.inner.next().map(|(k, _)| k) |
20 | 0 | } |
21 | | } |
22 | | |
23 | | unsafe impl<K, S> Send for OwningIter<K, S> |
24 | | where |
25 | | K: Eq + Hash + Send, |
26 | | S: BuildHasher + Clone + Send, |
27 | | { |
28 | | } |
29 | | |
30 | | unsafe impl<K, S> Sync for OwningIter<K, S> |
31 | | where |
32 | | K: Eq + Hash + Sync, |
33 | | S: BuildHasher + Clone + Sync, |
34 | | { |
35 | | } |
36 | | |
37 | | pub struct Iter<'a, K, S, M> { |
38 | | inner: crate::iter::Iter<'a, K, (), S, M>, |
39 | | } |
40 | | |
41 | | unsafe impl<'a, 'i, K, S, M> Send for Iter<'i, K, S, M> |
42 | | where |
43 | | K: 'a + Eq + Hash + Send, |
44 | | S: 'a + BuildHasher + Clone, |
45 | | M: Map<'a, K, (), S>, |
46 | | { |
47 | | } |
48 | | |
49 | | unsafe impl<'a, 'i, K, S, M> Sync for Iter<'i, K, S, M> |
50 | | where |
51 | | K: 'a + Eq + Hash + Sync, |
52 | | S: 'a + BuildHasher + Clone, |
53 | | M: Map<'a, K, (), S>, |
54 | | { |
55 | | } |
56 | | |
57 | | impl<'a, K: Eq + Hash, S: 'a + BuildHasher + Clone, M: Map<'a, K, (), S>> Iter<'a, K, S, M> { |
58 | 0 | pub(crate) fn new(inner: crate::iter::Iter<'a, K, (), S, M>) -> Self { |
59 | 0 | Self { inner } |
60 | 0 | } |
61 | | } |
62 | | |
63 | | impl<'a, K: Eq + Hash, S: 'a + BuildHasher + Clone, M: Map<'a, K, (), S>> Iterator |
64 | | for Iter<'a, K, S, M> |
65 | | { |
66 | | type Item = RefMulti<'a, K>; |
67 | | |
68 | 0 | fn next(&mut self) -> Option<Self::Item> { |
69 | 0 | self.inner.next().map(RefMulti::new) |
70 | 0 | } |
71 | | } |