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

Function structref_owned_to_eqref

tests/all/structs.rs:809–825  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

807
808#[test]
809fn structref_owned_to_eqref() -> Result<()> {
810 let mut store = gc_store()?;
811 let struct_ty = StructType::new(
812 store.engine(),
813 [FieldType::new(Mutability::Const, ValType::I32.into())],
814 )?;
815 let pre = StructRefPre::new(&mut store, struct_ty);
816 let s = StructRef::new(&mut store, &pre, &[Val::I32(5)])?;
817 let owned = s.to_owned_rooted(&mut store)?;
818
819 // OwnedRooted<StructRef>::to_eqref upcast
820 let eq_owned: OwnedRooted<EqRef> = owned.to_eqref();
821 let eq = eq_owned.to_rooted(&mut store);
822 assert!(eq.is_struct(&store)?);
823
824 Ok(())
825}
826
827#[test]
828fn structref_ty() -> Result<()> {

Callers

nothing calls this directly

Calls 7

gc_storeFunction · 0.85
OkFunction · 0.85
newFunction · 0.50
engineMethod · 0.45
to_owned_rootedMethod · 0.45
to_eqrefMethod · 0.45
to_rootedMethod · 0.45

Tested by

no test coverage detected