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

Function instance_pre

tests/all/linker.rs:342–371  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

340#[test]
341#[cfg_attr(miri, ignore)]
342fn instance_pre() -> Result<()> {
343 let engine = Engine::default();
344 let mut linker = Linker::new(&engine);
345 linker.func_wrap("", "", || {})?;
346
347 let module = Module::new(&engine, r#"(module (import "" "" (func)))"#)?;
348 let instance_pre = linker.instantiate_pre(&module)?;
349 instance_pre.instantiate(&mut Store::new(&engine, ()))?;
350 instance_pre.instantiate(&mut Store::new(&engine, ()))?;
351
352 let mut store = Store::new(&engine, ());
353 let global = Global::new(
354 &mut store,
355 GlobalType::new(ValType::I32, Mutability::Const),
356 1.into(),
357 )?;
358 linker.define(&mut store, "", "g", global)?;
359
360 let module = Module::new(
361 &engine,
362 r#"(module
363 (import "" "" (func))
364 (import "" "g" (global i32))
365 )"#,
366 )?;
367 let instance_pre = linker.instantiate_pre(&module)?;
368 instance_pre.instantiate(&mut store)?;
369 instance_pre.instantiate(&mut store)?;
370 Ok(())
371}
372
373#[test]
374#[cfg_attr(miri, ignore)]

Callers

nothing calls this directly

Calls 6

OkFunction · 0.85
newFunction · 0.50
func_wrapMethod · 0.45
instantiate_preMethod · 0.45
instantiateMethod · 0.45
defineMethod · 0.45

Tested by

no test coverage detected