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

Function array_new_with_elems

tests/all/arrays.rs:20–33  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

18
19#[test]
20fn array_new_with_elems() -> Result<()> {
21 let mut store = gc_store()?;
22 let array_ty = ArrayType::new(
23 store.engine(),
24 FieldType::new(Mutability::Const, ValType::I32.into()),
25 );
26 let pre = ArrayRefPre::new(&mut store, array_ty);
27 let array = ArrayRef::new(&mut store, &pre, &Val::I32(99), 3)?;
28 assert_eq!(array.len(&store)?, 3);
29 for i in 0..3 {
30 assert_eq!(array.get(&mut store, i)?.unwrap_i32(), 99);
31 }
32 Ok(())
33}
34
35#[test]
36fn array_new_unrooted_initial_elem() -> Result<()> {

Callers

nothing calls this directly

Calls 4

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

Tested by

no test coverage detected