1mod r#usize;
2
3#[allow(clippy::len_without_is_empty)]
4pub trait Set {
6 type Item: Clone + Ord;
8
9 type Map<V>: Map<Self::Item, V>;
15
16 type Iter<'a>: 'a + Iterator<Item = Self::Item>
18 where
19 Self: 'a;
20
21 fn len(&self) -> usize;
23
24 fn iter(&self) -> Self::Iter<'_>;
26
27 fn map<V: Clone, F>(&self, f: F) -> Self::Map<V>
28 where
29 F: Fn(&Self::Item) -> V;
30}
31
32pub trait Map<K, T> {
33 fn len(&self) -> usize;
34
35 fn is_empty(&self) -> bool {
36 self.len() == 0
37 }
38
39 fn get(&self, key: &K) -> Option<&T>;
40
41 fn set(&mut self, key: &K, value: T);
42
43 fn map<F>(&mut self, f: F)
44 where
45 F: Fn(&K, T) -> T;
46}