MCPcopy Create free account
hub / github.com/carsonpo/haystackdb / difference

Method difference

src/structures/filters.rs:75–93  ·  view source on GitHub ↗
(&self, other: &Filters)

Source from the content-addressed store, hash-verified

73 }
74
75 pub fn difference(&self, other: &Filters) -> Filters {
76 let other_indices_set: HashSet<_> = other.current_indices.iter().collect();
77 let difference_indices = self
78 .current_indices
79 .iter()
80 .filter(|&x| !other_indices_set.contains(x))
81 .cloned()
82 .collect::<Vec<_>>();
83
84 let other_ids_set: HashSet<_> = other.current_ids.iter().collect();
85 let difference_ids = self
86 .current_ids
87 .iter()
88 .filter(|&x| !other_ids_set.contains(x))
89 .cloned()
90 .collect::<Vec<_>>();
91
92 Filters::new(difference_indices, difference_ids)
93 }
94
95 pub fn is_subset(&self, other: &Filters) -> bool {
96 self.current_indices

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected