oxilean_std/hashset/
oxihashset_len_group.rs1use super::oxihashset_type::OxiHashSet;
8use std::hash::Hash;
9
10impl<T: Eq + Hash + Clone> OxiHashSet<T> {
11 pub fn len(&self) -> usize {
13 self.inner.len()
14 }
15 pub fn exclusive_count(&self, other: &Self) -> usize {
17 self.difference(other).len()
18 }
19 pub fn union_size(&self, other: &Self) -> usize {
21 self.union(other).len()
22 }
23 pub fn jaccard(&self, other: &Self) -> f64 {
25 let u = self.union_size(other);
26 if u == 0 {
27 1.0
28 } else {
29 self.intersection(other).len() as f64 / u as f64
30 }
31 }
32}