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

Function externref_data_mut_some

tests/all/gc.rs:2587–2597  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2585
2586#[test]
2587fn externref_data_mut_some() -> Result<()> {
2588 let mut store = gc_store()?;
2589 let rooted = ExternRef::new(&mut store, 1u32)?;
2590 {
2591 let data = rooted.data_mut(&mut store)?;
2592 *data.unwrap().downcast_mut::<u32>().unwrap() = 999;
2593 }
2594 let val = rooted.data(&store)?.unwrap().downcast_ref::<u32>().unwrap();
2595 assert_eq!(*val, 999u32);
2596 Ok(())
2597}
2598
2599#[test]
2600fn externref_data_none_when_converted_from_anyref() -> Result<()> {

Callers

nothing calls this directly

Calls 6

gc_storeFunction · 0.85
OkFunction · 0.85
newFunction · 0.50
data_mutMethod · 0.45
unwrapMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected