Helper function: get all nodes reachable from a given node
(
start: &'a str,
includes_map: &HashMap<&'a str, HashSet<&'a str>>
)
| 267 | |
| 268 | // Helper function: get all nodes reachable from a given node |
| 269 | fn get_reachable_nodes<'a>( |
| 270 | start: &'a str, |
| 271 | includes_map: &HashMap<&'a str, HashSet<&'a str>> |
| 272 | ) -> HashSet<&'a str> { |
| 273 | let mut reachable = HashSet::new(); |
| 274 | let mut stack = vec![start]; |
| 275 | let mut visited = HashSet::new(); |
| 276 | |
| 277 | while let Some(current) = stack.pop() { |
| 278 | if visited.contains(current) { |
| 279 | continue; |
| 280 | } |
| 281 | visited.insert(current); |
| 282 | reachable.insert(current); |
| 283 | |
| 284 | if let Some(children) = includes_map.get(current) { |
| 285 | for &child in children { |
| 286 | if !visited.contains(child) { |
| 287 | stack.push(child); |
| 288 | } |
| 289 | } |
| 290 | } |
| 291 | } |
| 292 | |
| 293 | reachable |
| 294 | } |
| 295 | |
| 296 | |
| 297 | fn is_a_lib_header(name: &str) -> bool { |
no test coverage detected