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