1use core::hash::BuildHasher;
2use std::collections::HashSet;
3
4use crate::collection::SetCollection;
5
6pub type Hash<'l, Item> = crate::collection::CollectionSet<'l, HashSet<Item>>;
10
11impl<Item: Clone + Eq + std::hash::Hash, S: BuildHasher + Default> SetCollection
12 for HashSet<Item, S>
13{
14 type Item = Item;
15
16 type ExtendMemory = Item;
17
18 #[inline]
19 fn new() -> Self {
20 Self::with_hasher(S::default())
21 }
22
23 #[inline]
24 fn extend(&mut self, new_item: Self::Item) -> Self::ExtendMemory {
25 self.insert(new_item.clone());
26 new_item
27 }
28
29 #[inline]
30 fn contains_ref(&self, item: &Self::Item) -> bool {
31 std::collections::HashSet::contains(self, item)
32 }
33
34 #[inline]
35 fn remove(&mut self, present_item: Self::ExtendMemory) {
36 std::collections::HashSet::remove(self, &present_item);
37 }
38
39 type IntoIter<'i>
40 = std::collections::hash_set::Iter<'i, Item>
41 where
42 Self: 'i;
43
44 #[inline]
45 fn iter(&self) -> Self::IntoIter<'_> {
46 std::collections::HashSet::iter(self)
47 }
48}