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

Function wasmtime_arrayref_set

crates/c-api/src/arrayref.rs:112–128  ·  view source on GitHub ↗
(
    mut cx: WasmtimeStoreContextMut<'_>,
    arrayref: Option<&wasmtime_arrayref_t>,
    index: u32,
    val: &crate::wasmtime_val_t,
)

Source from the content-addressed store, hash-verified

110
111#[unsafe(no_mangle)]
112pub unsafe extern "C" fn wasmtime_arrayref_set(
113 mut cx: WasmtimeStoreContextMut<'_>,
114 arrayref: Option<&wasmtime_arrayref_t>,
115 index: u32,
116 val: &crate::wasmtime_val_t,
117) -> Option<Box<crate::wasmtime_error_t>> {
118 let arrayref = arrayref
119 .and_then(|a| a.as_wasmtime())
120 .expect("non-null arrayref required");
121 let mut scope = RootScope::new(&mut cx);
122 let rooted = arrayref.to_rooted(&mut scope);
123 let rust_val = val.to_val(&mut scope);
124 match rooted.set(&mut scope, index, rust_val) {
125 Ok(()) => None,
126 Err(e) => Some(Box::new(e.into())),
127 }
128}
129
130#[unsafe(no_mangle)]
131pub unsafe extern "C" fn wasmtime_arrayref_type(

Callers 1

setMethod · 0.85

Calls 6

as_wasmtimeMethod · 0.80
to_valMethod · 0.80
newFunction · 0.50
expectMethod · 0.45
to_rootedMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected