(
mut cx: WasmtimeStoreContextMut<'_>,
arrayref: Option<&wasmtime_arrayref_t>,
index: u32,
out: &mut MaybeUninit<crate::wasmtime_val_t>,
)
| 88 | |
| 89 | #[unsafe(no_mangle)] |
| 90 | pub unsafe extern "C" fn wasmtime_arrayref_get( |
| 91 | mut cx: WasmtimeStoreContextMut<'_>, |
| 92 | arrayref: Option<&wasmtime_arrayref_t>, |
| 93 | index: u32, |
| 94 | out: &mut MaybeUninit<crate::wasmtime_val_t>, |
| 95 | ) -> Option<Box<crate::wasmtime_error_t>> { |
| 96 | let arrayref = arrayref |
| 97 | .and_then(|a| a.as_wasmtime()) |
| 98 | .expect("non-null arrayref required"); |
| 99 | let mut scope = RootScope::new(&mut cx); |
| 100 | let rooted = arrayref.to_rooted(&mut scope); |
| 101 | match rooted.get(&mut scope, index) { |
| 102 | Ok(val) => { |
| 103 | let c_val = crate::wasmtime_val_t::from_val(&mut scope, val); |
| 104 | crate::initialize(out, c_val); |
| 105 | None |
| 106 | } |
| 107 | Err(e) => Some(Box::new(e.into())), |
| 108 | } |
| 109 | } |
| 110 | |
| 111 | #[unsafe(no_mangle)] |
| 112 | pub unsafe extern "C" fn wasmtime_arrayref_set( |
no test coverage detected