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

Function struct_set_field_simple

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

Source from the content-addressed store, hash-verified

166
167#[test]
168fn struct_set_field_simple() -> Result<()> {
169 let mut store = gc_store()?;
170 let struct_ty = StructType::new(
171 store.engine(),
172 [FieldType::new(
173 Mutability::Var,
174 StorageType::ValType(ValType::I32),
175 )],
176 )?;
177 let pre = StructRefPre::new(&mut store, struct_ty);
178 let s = StructRef::new(&mut store, &pre, &[Val::I32(1234)])?;
179 s.set_field(&mut store, 0, Val::I32(5678))?;
180 let val = s.field(&mut store, 0)?;
181 assert_eq!(val.unwrap_i32(), 5678);
182 Ok(())
183}
184
185#[test]
186fn struct_set_field_out_of_bounds() -> Result<()> {

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected