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

Function wasmtime_anyref_as_array

crates/c-api/src/anyref.rs:278–294  ·  view source on GitHub ↗
(
    mut cx: WasmtimeStoreContextMut<'_>,
    anyref: Option<&wasmtime_anyref_t>,
    out: &mut MaybeUninit<wasmtime_arrayref_t>,
)

Source from the content-addressed store, hash-verified

276
277#[unsafe(no_mangle)]
278pub unsafe extern "C" fn wasmtime_anyref_as_array(
279 mut cx: WasmtimeStoreContextMut<'_>,
280 anyref: Option<&wasmtime_anyref_t>,
281 out: &mut MaybeUninit<wasmtime_arrayref_t>,
282) -> bool {
283 if let Some(anyref) = anyref.and_then(|a| a.as_wasmtime()) {
284 let mut scope = RootScope::new(&mut cx);
285 let rooted = anyref.to_rooted(&mut scope);
286 if let Ok(Some(arrayref)) = rooted.as_array(&scope) {
287 let owned = arrayref.to_owned_rooted(&mut scope).expect("in scope");
288 crate::initialize(out, Some(owned).into());
289 return true;
290 }
291 }
292 crate::initialize(out, None::<OwnedRooted<ArrayRef>>.into());
293 false
294}
295
296#[unsafe(no_mangle)]
297pub unsafe extern "C" fn wasmtime_anyref_type(

Callers 1

as_arrayMethod · 0.85

Calls 7

as_wasmtimeMethod · 0.80
initializeFunction · 0.70
newFunction · 0.50
to_rootedMethod · 0.45
as_arrayMethod · 0.45
expectMethod · 0.45
to_owned_rootedMethod · 0.45

Tested by

no test coverage detected