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

Function structref_to_eqref_rooted

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

Source from the content-addressed store, hash-verified

771
772#[test]
773fn structref_to_eqref_rooted() -> Result<()> {
774 let mut store = gc_store()?;
775 let struct_ty = StructType::new(
776 store.engine(),
777 [FieldType::new(Mutability::Const, ValType::I32.into())],
778 )?;
779 let pre = StructRefPre::new(&mut store, struct_ty);
780 let s = StructRef::new(&mut store, &pre, &[Val::I32(10)])?;
781
782 // Rooted<StructRef>::to_eqref upcast
783 let eq: Rooted<EqRef> = s.to_eqref();
784 assert!(eq.is_struct(&store)?);
785
786 Ok(())
787}
788
789#[test]
790fn structref_owned_to_anyref() -> Result<()> {

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected