1mod b_tree_map_private { pub trait Sealed<K, V> { } }
4
5pub trait IsntBTreeMapExt<K, V>: b_tree_map_private::Sealed<K, V> {
7 #[must_use]
9 fn is_not_empty(&self) -> bool;
10 #[must_use]
12 fn not_contains_key<Q>(&self, key: &Q) -> bool where K: std::borrow::Borrow<Q> + Ord, Q: Ord + ?Sized,;
13}
14
15impl<K, V> b_tree_map_private::Sealed<K, V> for std::collections::BTreeMap<K, V> { }
16
17impl<K, V> IsntBTreeMapExt<K, V> for std::collections::BTreeMap<K, V> {
18 #[inline]
19 fn is_not_empty(&self) -> bool {
20 !self.is_empty()
21 }
22
23 #[inline]
24 fn not_contains_key<Q>(&self, key: &Q) -> bool where K: std::borrow::Borrow<Q> + Ord, Q: Ord + ?Sized, {
25 !self.contains_key::<Q>(key)
26 }
27}
28
29mod b_tree_set_private { pub trait Sealed<T> { } }
30
31pub trait IsntBTreeSetExt<T>: b_tree_set_private::Sealed<T> {
33 #[must_use]
35 fn not_contains<Q>(&self, value: &Q) -> bool where T: std::borrow::Borrow<Q> + Ord, Q: Ord + ?Sized;
36 #[must_use]
38 fn is_not_disjoint(&self, other: &std::collections::BTreeSet<T>) -> bool where T: Ord;
39 #[must_use]
41 fn is_not_subset(&self, other: &std::collections::BTreeSet<T>) -> bool where T: Ord;
42 #[must_use]
44 fn is_not_superset(&self, other: &std::collections::BTreeSet<T>) -> bool where T: Ord;
45 #[must_use]
47 fn not_insert(&mut self, value: T) -> bool where T: Ord;
48 #[must_use]
50 fn not_remove<Q>(&mut self, value: &Q) -> bool where T: std::borrow::Borrow<Q> + Ord, Q: Ord + ?Sized;
51 #[must_use]
53 fn is_not_empty(&self) -> bool;
54}
55
56impl<T> b_tree_set_private::Sealed<T> for std::collections::BTreeSet<T> { }
57
58impl<T> IsntBTreeSetExt<T> for std::collections::BTreeSet<T> {
59 #[inline]
60 fn not_contains<Q>(&self, value: &Q) -> bool where T: std::borrow::Borrow<Q> + Ord, Q: Ord + ?Sized {
61 !self.contains::<Q>(value)
62 }
63
64 #[inline]
65 fn is_not_disjoint(&self, other: &std::collections::BTreeSet<T>) -> bool where T: Ord {
66 !self.is_disjoint(other)
67 }
68
69 #[inline]
70 fn is_not_subset(&self, other: &std::collections::BTreeSet<T>) -> bool where T: Ord {
71 !self.is_subset(other)
72 }
73
74 #[inline]
75 fn is_not_superset(&self, other: &std::collections::BTreeSet<T>) -> bool where T: Ord {
76 !self.is_superset(other)
77 }
78
79 #[inline]
80 fn not_insert(&mut self, value: T) -> bool where T: Ord {
81 !self.insert(value)
82 }
83
84 #[inline]
85 fn not_remove<Q>(&mut self, value: &Q) -> bool where T: std::borrow::Borrow<Q> + Ord, Q: Ord + ?Sized {
86 !self.remove::<Q>(value)
87 }
88
89 #[inline]
90 fn is_not_empty(&self) -> bool {
91 !self.is_empty()
92 }
93}
94
95mod binary_heap_private { pub trait Sealed<T> { } }
96
97pub trait IsntBinaryHeapExt<T>: binary_heap_private::Sealed<T> {
99 #[must_use]
101 fn is_not_empty(&self) -> bool;
102}
103
104impl<T> binary_heap_private::Sealed<T> for std::collections::BinaryHeap<T> { }
105
106impl<T> IsntBinaryHeapExt<T> for std::collections::BinaryHeap<T> {
107 #[inline]
108 fn is_not_empty(&self) -> bool {
109 !self.is_empty()
110 }
111}
112
113mod hash_map_private { pub trait Sealed<K, V, S> { } }
114
115pub trait IsntHashMapExt<K, V, S>: hash_map_private::Sealed<K, V, S> {
117 #[must_use]
119 fn is_not_empty(&self) -> bool;
120 #[must_use]
122 fn not_contains_key<Q>(&self, k: &Q) -> bool where K: std::borrow::Borrow<Q> + std::hash::Hash + Eq, Q: std::hash::Hash + Eq + ?Sized, S: std::hash::BuildHasher;
123}
124
125impl<K, V, S> hash_map_private::Sealed<K, V, S> for std::collections::HashMap<K, V, S> { }
126
127impl<K, V, S> IsntHashMapExt<K, V, S> for std::collections::HashMap<K, V, S> {
128 #[inline]
129 fn is_not_empty(&self) -> bool {
130 !self.is_empty()
131 }
132
133 #[inline]
134 fn not_contains_key<Q>(&self, k: &Q) -> bool where K: std::borrow::Borrow<Q> + std::hash::Hash + Eq, Q: std::hash::Hash + Eq + ?Sized, S: std::hash::BuildHasher {
135 !self.contains_key::<Q>(k)
136 }
137}
138
139mod hash_set_private { pub trait Sealed<T, S> { } }
140
141pub trait IsntHashSetExt<T, S>: hash_set_private::Sealed<T, S> {
143 #[must_use]
145 fn is_not_empty(&self) -> bool;
146 #[must_use]
148 fn not_contains<Q>(&self, value: &Q) -> bool where T: std::borrow::Borrow<Q> + std::hash::Hash + Eq, Q: std::hash::Hash + Eq + ?Sized, S: std::hash::BuildHasher;
149 #[must_use]
151 fn is_not_disjoint(&self, other: &std::collections::HashSet<T, S>) -> bool where T: std::hash::Hash + Eq, S: std::hash::BuildHasher;
152 #[must_use]
154 fn is_not_subset(&self, other: &std::collections::HashSet<T, S>) -> bool where T: std::hash::Hash + Eq, S: std::hash::BuildHasher;
155 #[must_use]
157 fn is_not_superset(&self, other: &std::collections::HashSet<T, S>) -> bool where T: std::hash::Hash + Eq, S: std::hash::BuildHasher;
158 #[must_use]
160 fn not_insert(&mut self, value: T) -> bool where T: std::hash::Hash + Eq, S: std::hash::BuildHasher;
161 #[must_use]
163 fn not_remove<Q>(&mut self, value: &Q) -> bool where T: std::borrow::Borrow<Q> + std::hash::Hash + Eq, Q: std::hash::Hash + Eq + ?Sized, S: std::hash::BuildHasher;
164}
165
166impl<T, S> hash_set_private::Sealed<T, S> for std::collections::HashSet<T, S> { }
167
168impl<T, S> IsntHashSetExt<T, S> for std::collections::HashSet<T, S> {
169 #[inline]
170 fn is_not_empty(&self) -> bool {
171 !self.is_empty()
172 }
173
174 #[inline]
175 fn not_contains<Q>(&self, value: &Q) -> bool where T: std::borrow::Borrow<Q> + std::hash::Hash + Eq, Q: std::hash::Hash + Eq + ?Sized, S: std::hash::BuildHasher {
176 !self.contains::<Q>(value)
177 }
178
179 #[inline]
180 fn is_not_disjoint(&self, other: &std::collections::HashSet<T, S>) -> bool where T: std::hash::Hash + Eq, S: std::hash::BuildHasher {
181 !self.is_disjoint(other)
182 }
183
184 #[inline]
185 fn is_not_subset(&self, other: &std::collections::HashSet<T, S>) -> bool where T: std::hash::Hash + Eq, S: std::hash::BuildHasher {
186 !self.is_subset(other)
187 }
188
189 #[inline]
190 fn is_not_superset(&self, other: &std::collections::HashSet<T, S>) -> bool where T: std::hash::Hash + Eq, S: std::hash::BuildHasher {
191 !self.is_superset(other)
192 }
193
194 #[inline]
195 fn not_insert(&mut self, value: T) -> bool where T: std::hash::Hash + Eq, S: std::hash::BuildHasher {
196 !self.insert(value)
197 }
198
199 #[inline]
200 fn not_remove<Q>(&mut self, value: &Q) -> bool where T: std::borrow::Borrow<Q> + std::hash::Hash + Eq, Q: std::hash::Hash + Eq + ?Sized, S: std::hash::BuildHasher {
201 !self.remove::<Q>(value)
202 }
203}
204
205mod linked_list_private { pub trait Sealed<T> { } }
206
207pub trait IsntLinkedListExt<T>: linked_list_private::Sealed<T> {
209 #[must_use]
211 fn is_not_empty(&self) -> bool;
212 #[must_use]
214 fn not_contains(&self, x: &T) -> bool where T: PartialEq;
215}
216
217impl<T> linked_list_private::Sealed<T> for std::collections::LinkedList<T> { }
218
219impl<T> IsntLinkedListExt<T> for std::collections::LinkedList<T> {
220 #[inline]
221 fn is_not_empty(&self) -> bool {
222 !self.is_empty()
223 }
224
225 #[inline]
226 fn not_contains(&self, x: &T) -> bool where T: PartialEq {
227 !self.contains(x)
228 }
229}
230
231mod vec_deque_private { pub trait Sealed<T> { } }
232
233pub trait IsntVecDequeExt<T>: vec_deque_private::Sealed<T> {
235 #[must_use]
237 fn is_not_empty(&self) -> bool;
238 #[must_use]
240 fn not_contains(&self, x: &T) -> bool where T: PartialEq<T>,;
241}
242
243impl<T> vec_deque_private::Sealed<T> for std::collections::VecDeque<T> { }
244
245impl<T> IsntVecDequeExt<T> for std::collections::VecDeque<T> {
246 #[inline]
247 fn is_not_empty(&self) -> bool {
248 !self.is_empty()
249 }
250
251 #[inline]
252 fn not_contains(&self, x: &T) -> bool where T: PartialEq<T>, {
253 !self.contains(x)
254 }
255}