| 42 | } |
| 43 | |
| 44 | pub fn intersection(&self, other: &Filters) -> Filters { |
| 45 | let intersection_indices: Vec<usize> = self |
| 46 | .current_indices |
| 47 | .par_iter() |
| 48 | .filter(|&x| other.current_indices.contains(x)) |
| 49 | .cloned() |
| 50 | .collect(); |
| 51 | |
| 52 | let intersection_ids: Vec<u128> = self |
| 53 | .current_ids |
| 54 | .par_iter() |
| 55 | .filter(|&x| other.current_ids.contains(x)) |
| 56 | .cloned() |
| 57 | .collect(); |
| 58 | |
| 59 | Filters::new(intersection_indices, intersection_ids) |
| 60 | } |
| 61 | pub fn union(&self, other: &Filters) -> Filters { |
| 62 | let mut union_indices = self.current_indices.clone(); |
| 63 | union_indices.extend(other.current_indices.iter().cloned()); |