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

Function anyref_to_raw_struct

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

Source from the content-addressed store, hash-verified

2559
2560#[test]
2561fn anyref_to_raw_struct() -> Result<()> {
2562 let mut store = gc_store()?;
2563 let struct_ty = StructType::new(
2564 store.engine(),
2565 [FieldType::new(Mutability::Const, ValType::I32.into())],
2566 )?;
2567 let pre = StructRefPre::new(&mut store, struct_ty);
2568 let s = StructRef::new(&mut store, &pre, &[Val::I32(99)])?;
2569 let any: Rooted<AnyRef> = s.into();
2570 // to_raw on a non-i31 anyref exercises the else-branch in to_raw
2571 let raw = any.to_raw(&mut store)?;
2572 assert_ne!(raw, 0);
2573 Ok(())
2574}
2575
2576#[test]
2577fn externref_data_some() -> Result<()> {

Callers

nothing calls this directly

Calls 5

gc_storeFunction · 0.85
OkFunction · 0.85
newFunction · 0.50
engineMethod · 0.45
to_rawMethod · 0.45

Tested by

no test coverage detected