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

Function struct_field_simple

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

Source from the content-addressed store, hash-verified

113
114#[test]
115fn struct_field_simple() -> Result<()> {
116 let mut store = gc_store()?;
117 let struct_ty = StructType::new(
118 store.engine(),
119 [FieldType::new(
120 Mutability::Var,
121 StorageType::ValType(ValType::I32),
122 )],
123 )?;
124 let pre = StructRefPre::new(&mut store, struct_ty);
125 let s = StructRef::new(&mut store, &pre, &[Val::I32(1234)])?;
126 let val = s.field(&mut store, 0)?;
127 assert_eq!(val.unwrap_i32(), 1234);
128 Ok(())
129}
130
131#[test]
132fn struct_field_out_of_bounds() -> Result<()> {

Callers

nothing calls this directly

Calls 6

gc_storeFunction · 0.85
OkFunction · 0.85
newFunction · 0.50
ValTypeEnum · 0.50
engineMethod · 0.45
fieldMethod · 0.45

Tested by

no test coverage detected