Recursively collect all nodes and dependency relationships
(
node: &'a TreeNode,
all_nodes: &mut HashMap<&'a str, &'a TreeNode>,
included_by_others: &mut HashSet<&'a str>,
includes_map: &mut HashMap<&'a str, HashSet<&'a str>>
| 162 | |
| 163 | // Recursively collect all nodes and dependency relationships |
| 164 | fn collect_nodes<'a>( |
| 165 | node: &'a TreeNode, |
| 166 | all_nodes: &mut HashMap<&'a str, &'a TreeNode>, |
| 167 | included_by_others: &mut HashSet<&'a str>, |
| 168 | includes_map: &mut HashMap<&'a str, HashSet<&'a str>> |
| 169 | ) { |
| 170 | let name = node.get_name(); |
| 171 | all_nodes.insert(name, node); |
| 172 | |
| 173 | let mut children_set = HashSet::new(); |
| 174 | |
| 175 | // Collect all child nodes, which are included by the current node |
| 176 | for child in &node.children { |
| 177 | let child_name = child.get_name(); |
| 178 | included_by_others.insert(child_name); |
| 179 | children_set.insert(child_name); |
| 180 | collect_nodes(child, all_nodes, included_by_others, includes_map); |
| 181 | } |
| 182 | |
| 183 | includes_map.insert(name, children_set); |
| 184 | } |
| 185 | |
| 186 | // Collect nodes for each tree |
| 187 | for tree in trees { |
no test coverage detected