1use std::{
2 collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, LinkedList, VecDeque},
3 hash::Hash,
4 rc::Rc,
5 sync::Arc,
6};
7
8use dashmap::{DashMap, DashSet};
9
10pub trait Empty {
11 fn is_empty(&self) -> bool;
12}
13
14impl<T: Empty> Empty for Box<T> {
15 fn is_empty(&self) -> bool {
16 self.as_ref().is_empty()
17 }
18}
19
20impl<T: Empty> Empty for Rc<T> {
21 fn is_empty(&self) -> bool {
22 self.as_ref().is_empty()
23 }
24}
25
26impl<T: Empty> Empty for Arc<T> {
27 fn is_empty(&self) -> bool {
28 self.as_ref().is_empty()
29 }
30}
31
32impl Empty for () {
33 fn is_empty(&self) -> bool {
34 true
35 }
36}
37
38impl<V> Empty for Option<V> {
39 fn is_empty(&self) -> bool {
40 self.is_none()
41 }
42}
43
44impl<V> Empty for Vec<V> {
45 fn is_empty(&self) -> bool {
46 Vec::is_empty(self)
47 }
48}
49
50impl<V> Empty for VecDeque<V> {
51 fn is_empty(&self) -> bool {
52 VecDeque::is_empty(self)
53 }
54}
55
56impl<V> Empty for LinkedList<V> {
57 fn is_empty(&self) -> bool {
58 LinkedList::is_empty(self)
59 }
60}
61
62impl<V> Empty for BinaryHeap<V> {
63 fn is_empty(&self) -> bool {
64 BinaryHeap::is_empty(self)
65 }
66}
67
68impl<K, V> Empty for BTreeMap<K, V> {
69 fn is_empty(&self) -> bool {
70 BTreeMap::is_empty(self)
71 }
72}
73
74impl<V> Empty for BTreeSet<V> {
75 fn is_empty(&self) -> bool {
76 BTreeSet::is_empty(self)
77 }
78}
79
80impl<K, V> Empty for HashMap<K, V> {
81 fn is_empty(&self) -> bool {
82 HashMap::is_empty(self)
83 }
84}
85
86impl<V> Empty for HashSet<V> {
87 fn is_empty(&self) -> bool {
88 HashSet::is_empty(self)
89 }
90}
91
92impl<K: Eq + Hash, V> Empty for DashMap<K, V> {
93 fn is_empty(&self) -> bool {
94 DashMap::is_empty(self)
95 }
96}
97
98impl<K: Eq + Hash> Empty for DashSet<K> {
99 fn is_empty(&self) -> bool {
100 DashSet::is_empty(self)
101 }
102}