| 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>>() |