MCPcopy Create free account
hub / github.com/bytecodealliance/wit-bindgen / push

Method push

crates/test/src/lib.rs:799–825  ·  view source on GitHub ↗

Recursive function which walks over `worlds`, the list of worlds that `test` expects, one by one. For each world it finds a matching component in `components` and then recurses for the next item in the `worlds` list. Once `worlds` is empty the `test` list, a temporary vector, is cloned and pushed into `commit`.

(
            worlds: &[String],
            components: &[(Component, PathBuf)],
            test: &mut Vec<(Component, PathBuf)>,
            commit: &mut dyn FnMut(Vec<(Component, PathBuf)>),
     

Source from the content-addressed store, hash-verified

797 /// Once `worlds` is empty the `test` list, a temporary vector, is
798 /// cloned and pushed into `commit`.
799 fn push(
800 worlds: &[String],
801 components: &[(Component, PathBuf)],
802 test: &mut Vec<(Component, PathBuf)>,
803 commit: &mut dyn FnMut(Vec<(Component, PathBuf)>),
804 ) -> Result<()> {
805 match worlds.split_first() {
806 Some((world, rest)) => {
807 let mut any = false;
808 for (component, path) in components {
809 if component.bindgen.world == *world {
810 any = true;
811 test.push((component.clone(), path.clone()));
812 push(rest, components, test, commit)?;
813 test.pop();
814 }
815 }
816 if !any {
817 bail!("no components found for `{world}`");
818 }
819 }
820
821 // No more `worlds`? Then `test` is our set of test components.
822 None => commit(test.clone()),
823 }
824 Ok(())
825 }
826
827 push(
828 &test.config.dependency_worlds(),

Callers 15

test_directoryFunction · 0.45
compileMethod · 0.45
load_runtime_testMethod · 0.45
all_languagesMethod · 0.45
run_codegen_testsMethod · 0.45
run_runtime_testsMethod · 0.45
push_testsMethod · 0.45
compose_wasm_with_wacMethod · 0.45
metadataMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected