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

Function store_with_context

tests/all/host_funcs.rs:702–722  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

700
701#[test]
702fn store_with_context() -> Result<()> {
703 struct Ctx {
704 called: bool,
705 }
706
707 let engine = Engine::default();
708 let mut linker = Linker::new(&engine);
709
710 linker.func_wrap("", "", |mut caller: Caller<'_, Ctx>| {
711 caller.data_mut().called = true;
712 })?;
713
714 let mut store = Store::new(&engine, Ctx { called: false });
715
716 let f = linker.get(&mut store, "", "").unwrap().into_func().unwrap();
717 f.call(&mut store, &[], &mut [])?;
718
719 assert!(store.data().called);
720
721 Ok(())
722}
723
724#[test]
725#[cfg_attr(miri, ignore)]

Callers

nothing calls this directly

Calls 8

OkFunction · 0.85
newFunction · 0.50
func_wrapMethod · 0.45
data_mutMethod · 0.45
unwrapMethod · 0.45
into_funcMethod · 0.45
getMethod · 0.45
callMethod · 0.45

Tested by

no test coverage detected