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

Function wasmtime_func_new

crates/c-api/src/func.rs:242–254  ·  view source on GitHub ↗
(
    store: WasmtimeStoreContextMut<'_>,
    ty: &wasm_functype_t,
    callback: wasmtime_func_callback_t,
    data: *mut c_void,
    finalizer: Option<extern "C" fn(*mut std::ffi::c_void)>,
    func

Source from the content-addressed store, hash-verified

240
241#[unsafe(no_mangle)]
242pub unsafe extern "C" fn wasmtime_func_new(
243 store: WasmtimeStoreContextMut<'_>,
244 ty: &wasm_functype_t,
245 callback: wasmtime_func_callback_t,
246 data: *mut c_void,
247 finalizer: Option<extern "C" fn(*mut std::ffi::c_void)>,
248 func: &mut Func,
249) {
250 let ty = ty.ty().ty(store.engine());
251 let cb = c_callback_to_rust_fn(callback, data, finalizer);
252 let f = Func::new(store, ty, cb);
253 *func = f;
254}
255
256pub(crate) unsafe fn c_callback_to_rust_fn(
257 callback: wasmtime_func_callback_t,

Callers 4

deserializeFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
FuncMethod · 0.85

Calls 4

c_callback_to_rust_fnFunction · 0.85
newFunction · 0.50
tyMethod · 0.45
engineMethod · 0.45

Tested by

no test coverage detected