MCPcopy Index your code
hub / github.com/emwalker/digraph / intersection

Method intersection

backend/tests/git/search.rs:101–119  ·  view source on GitHub ↗
(&self, topic_paths: &[TopicPath])

Source from the content-addressed store, hash-verified

99
100 impl Downset for FetchDownset {
101 fn intersection(&self, topic_paths: &[TopicPath]) -> Result<HashSet<ExternalId>> {
102 if topic_paths.is_empty() {
103 return Ok(HashSet::new());
104 }
105
106 let (head, tail) = topic_paths.split_at(1);
107 match head.first() {
108 Some(path) => {
109 let mut set = self.downset(path);
110 for other_path in tail {
111 let other = self.downset(other_path);
112 set.retain(|path| other.contains(path));
113 }
114 Ok(set)
115 }
116
117 None => Ok(HashSet::new()),
118 }
119 }
120
121 fn downset(&self, path: &TopicPath) -> HashSet<ExternalId> {
122 self.0.downset(path).collect::<HashSet<ExternalId>>()

Callers

nothing calls this directly

Calls 3

containsMethod · 0.80
is_emptyMethod · 0.45
downsetMethod · 0.45

Tested by

no test coverage detected