MCPcopy Create free account
hub / github.com/dfinity/orbit / apply

Method apply

libs/orbit-essentials/src/repository.rs:211–233  ·  view source on GitHub ↗
(&self, existing_ids: Option<&HashSet<Self::IdType>>)

Source from the content-addressed store, hash-verified

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.

Callers 2

find_with_filtersMethod · 0.45

Calls 3

containsMethod · 0.80
iterMethod · 0.80
is_emptyMethod · 0.45

Tested by 1