(
mut cx: WasmtimeStoreContextMut<'_>,
pre: &wasmtime_array_ref_pre_t,
elem: &crate::wasmtime_val_t,
len: u32,
out: &mut MaybeUninit<wasmtime_arrayref_t>,
)
| 25 | |
| 26 | #[unsafe(no_mangle)] |
| 27 | pub unsafe extern "C" fn wasmtime_arrayref_new( |
| 28 | mut cx: WasmtimeStoreContextMut<'_>, |
| 29 | pre: &wasmtime_array_ref_pre_t, |
| 30 | elem: &crate::wasmtime_val_t, |
| 31 | len: u32, |
| 32 | out: &mut MaybeUninit<wasmtime_arrayref_t>, |
| 33 | ) -> Option<Box<crate::wasmtime_error_t>> { |
| 34 | let mut scope = RootScope::new(&mut cx); |
| 35 | let val = elem.to_val(&mut scope); |
| 36 | match ArrayRef::new(&mut scope, &pre.pre, &val, len) { |
| 37 | Ok(arrayref) => { |
| 38 | let owned = arrayref |
| 39 | .to_owned_rooted(&mut scope) |
| 40 | .expect("just allocated"); |
| 41 | crate::initialize(out, Some(owned).into()); |
| 42 | None |
| 43 | } |
| 44 | Err(e) => { |
| 45 | crate::initialize(out, None::<OwnedRooted<ArrayRef>>.into()); |
| 46 | Some(Box::new(e.into())) |
| 47 | } |
| 48 | } |
| 49 | } |
| 50 | |
| 51 | #[unsafe(no_mangle)] |
| 52 | pub unsafe extern "C" fn wasmtime_arrayref_to_anyref( |
no test coverage detected