MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / run

Function run

tests/all/component_model/bindgen.rs:32–64  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

30
31 #[test]
32 fn run() -> Result<()> {
33 let engine = engine();
34
35 let component = Component::new(
36 &engine,
37 r#"
38 (component
39 (core module $m
40 (func (export ""))
41 )
42 (core instance $i (instantiate $m))
43
44 (func $f (export "bar") (canon lift (core func $i "")))
45
46 (instance $i (export "foo" (func $f)))
47 (export "foo" (instance $i))
48 )
49 "#,
50 )?;
51
52 let linker = Linker::new(&engine);
53 let mut store = Store::new(&engine, ());
54 let no_imports = NoImports::instantiate(&mut store, &component, &linker)?;
55 no_imports.call_bar(&mut store)?;
56 no_imports.foo().call_foo(&mut store)?;
57
58 let linker = Linker::new(&engine);
59 let mut non_send_store = Store::new(&engine, Rc::new(()));
60 let no_imports = NoImports::instantiate(&mut non_send_store, &component, &linker)?;
61 no_imports.call_bar(&mut non_send_store)?;
62 no_imports.foo().call_foo(&mut non_send_store)?;
63 Ok(())
64 }
65}
66
67mod no_imports_concurrent {

Callers 1

trappingFunction · 0.70

Calls 15

OkFunction · 0.85
instantiate_asyncFunction · 0.85
assert_successFunction · 0.85
assert_failureFunction · 0.85
run_concurrentMethod · 0.80
boxedMethod · 0.80
assert_containsMethod · 0.80
engineFunction · 0.50
newFunction · 0.50
instantiateFunction · 0.50
call_fooMethod · 0.45
fooMethod · 0.45

Tested by

no test coverage detected