Internally iterate through the leaf dependencies of the artifact at `artifact`
(artifact: &Path, mut handle: impl FnMut(&RawStr))
| 793 | |
| 794 | /// Internally iterate through the leaf dependencies of the artifact at `artifact` |
| 795 | fn leaf_deps(artifact: &Path, mut handle: impl FnMut(&RawStr)) -> std::io::Result<()> { |
| 796 | let deps_file = artifact.with_extension("d"); |
| 797 | let mut deps_map = HashMap::new(); |
| 798 | depfile::read_deps_file(&deps_file, |item, deps| { |
| 799 | deps_map.insert(item, deps); |
| 800 | Ok(()) |
| 801 | })?; |
| 802 | fn recurse( |
| 803 | map: &HashMap<RawString, Vec<RawString>>, |
| 804 | artifact: &RawStr, |
| 805 | handle: &mut impl FnMut(&RawStr), |
| 806 | ) { |
| 807 | match map.get(artifact) { |
| 808 | Some(entries) => { |
| 809 | for entry in entries { |
| 810 | recurse(map, entry, handle); |
| 811 | } |
| 812 | } |
| 813 | None => handle(artifact), |
| 814 | } |
| 815 | } |
| 816 | recurse(&deps_map, artifact.to_str().unwrap().into(), &mut handle); |
| 817 | Ok(()) |
| 818 | } |
no test coverage detected