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

Function mutability

tests/all/globals.rs:45–56  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

43
44#[test]
45fn mutability() -> wasmtime::Result<()> {
46 let mut store = Store::<()>::default();
47 let g = Global::new(
48 &mut store,
49 GlobalType::new(ValType::I32, Mutability::Var),
50 0.into(),
51 )?;
52 assert_eq!(g.get(&mut store).i32(), Some(0));
53 g.set(&mut store, 1.into())?;
54 assert_eq!(g.get(&mut store).i32(), Some(1));
55 Ok(())
56}
57
58// Make sure that a global is still usable after its original instance is
59// dropped. This is a bit of a weird test and really only fails depending on the

Callers

nothing calls this directly

Calls 3

OkFunction · 0.85
newFunction · 0.50
setMethod · 0.45

Tested by

no test coverage detected