defuse_map_utils/
iter.rs

1use crate::Map;
2
3pub trait IterableMap: Map {
4    type Keys<'a>: Iterator<Item = &'a Self::K>
5    where
6        Self: 'a;
7
8    type Values<'a>: Iterator<Item = &'a Self::V>
9    where
10        Self: 'a;
11    type ValuesMut<'a>: Iterator<Item = &'a mut Self::V>
12    where
13        Self: 'a;
14
15    type Iter<'a>: Iterator<Item = (&'a Self::K, &'a Self::V)>
16    where
17        Self: 'a;
18    type IterMut<'a>: Iterator<Item = (&'a Self::K, &'a mut Self::V)>
19    where
20        Self: 'a;
21
22    type Drain<'a>: Iterator<Item = (Self::K, Self::V)>
23    where
24        Self: 'a;
25
26    fn len(&self) -> usize;
27    fn is_empty(&self) -> bool {
28        self.len() == 0
29    }
30
31    fn keys(&self) -> Self::Keys<'_>;
32
33    fn values(&self) -> Self::Values<'_>;
34    fn values_mut(&mut self) -> Self::ValuesMut<'_>;
35
36    fn iter(&self) -> Self::Iter<'_>;
37    fn iter_mut(&mut self) -> Self::IterMut<'_>;
38
39    fn drain(&mut self) -> Self::Drain<'_>;
40    fn clear(&mut self);
41}