MCPcopy Create free account
hub / github.com/Rust-GPU/rust-gpu / leaf_deps

Function leaf_deps

crates/spirv-builder/src/lib.rs:795–818  ·  view source on GitHub ↗

Internally iterate through the leaf dependencies of the artifact at `artifact`

(artifact: &Path, mut handle: impl FnMut(&RawStr))

Source from the content-addressed store, hash-verified

793
794/// Internally iterate through the leaf dependencies of the artifact at `artifact`
795fn 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}

Callers 2

buildMethod · 0.85
watchMethod · 0.85

Calls 3

read_deps_fileFunction · 0.85
insertMethod · 0.80
recurseFunction · 0.70

Tested by

no test coverage detected