| 209 | type IdType = UUID; |
| 210 | |
| 211 | fn apply(&self, existing_ids: Option<&HashSet<Self::IdType>>) -> HashSet<Self::IdType> { |
| 212 | let mut found_ids: Option<HashSet<Self::IdType>> = None; |
| 213 | |
| 214 | for filter in &self.filters { |
| 215 | found_ids = Some(filter.apply(found_ids.as_ref())); |
| 216 | |
| 217 | if found_ids.as_ref().is_some_and(|ids| ids.is_empty()) { |
| 218 | break; |
| 219 | } |
| 220 | } |
| 221 | |
| 222 | let newly_found_ids = found_ids.unwrap_or_default(); |
| 223 | |
| 224 | match existing_ids { |
| 225 | Some(ids) => { |
| 226 | let mut new_ids = newly_found_ids; |
| 227 | new_ids.retain(|id| ids.contains(id)); |
| 228 | |
| 229 | new_ids |
| 230 | } |
| 231 | None => newly_found_ids, |
| 232 | } |
| 233 | } |
| 234 | } |
| 235 | |
| 236 | /// A filter that combines multiple filters using a logical OR operation. |