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

Function linker_module_reactor

tests/all/async_functions.rs:745–780  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

743#[tokio::test]
744#[cfg_attr(miri, ignore)]
745async fn linker_module_reactor() -> Result<()> {
746 let mut store = async_store();
747 let mut linker = Linker::new(store.engine());
748 let module1 = Module::new(
749 store.engine(),
750 r#"
751 (module
752 (global $g (mut i32) (i32.const 0))
753
754 (func (export "g") (result i32)
755 global.get $g
756 i32.const 1
757 global.set $g)
758 )
759 "#,
760 )?;
761 let module2 = Module::new(
762 store.engine(),
763 r#"
764 (module
765 (import "" "g" (func (result i32)))
766
767 (func (export "get") (result i32)
768 call 0)
769 )
770 "#,
771 )?;
772
773 linker.module_async(&mut store, "", &module1).await?;
774 let instance = linker.instantiate_async(&mut store, &module2).await?;
775 let f = instance.get_typed_func::<(), i32>(&mut store, "get")?;
776 assert_eq!(f.call_async(&mut store, ()).await?, 0);
777 assert_eq!(f.call_async(&mut store, ()).await?, 1);
778
779 Ok(())
780}
781
782pub struct CountPending<F> {
783 future: F,

Callers

nothing calls this directly

Calls 6

OkFunction · 0.85
module_asyncMethod · 0.80
async_storeFunction · 0.70
newFunction · 0.50
engineMethod · 0.45
instantiate_asyncMethod · 0.45

Tested by

no test coverage detected