stacked_set/
alloc_tree.rs1use alloc::collections::BTreeSet;
2
3use crate::collection::SetCollection;
4
5pub type TreeSet<'l, Item> =
14 crate::collection::CollectionSet<'l, alloc::collections::BTreeSet<Item>>;
15
16impl<Item: Ord + PartialEq + Clone> SetCollection for BTreeSet<Item> {
17 type Item = Item;
18
19 type ExtendMemory = Item;
20
21 #[inline]
22 fn new() -> Self {
23 Self::new()
24 }
25
26 #[inline]
27 fn extend(&mut self, new_item: Self::Item) -> Self::ExtendMemory {
28 self.insert(new_item.clone());
29 new_item
30 }
31
32 #[inline]
33 fn contains_ref(&self, item: &Self::Item) -> bool {
34 alloc::collections::BTreeSet::contains(self, item)
35 }
36
37 #[inline]
38 fn remove(&mut self, present_item: Self::ExtendMemory) {
39 alloc::collections::BTreeSet::remove(self, &present_item);
40 }
41
42 type IntoIter<'i>
43 = alloc::collections::btree_set::Iter<'i, Item>
44 where
45 Self: 'i;
46
47 #[inline]
48 fn iter(&self) -> Self::IntoIter<'_> {
49 alloc::collections::BTreeSet::iter(self)
50 }
51}