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

Method wrap

crates/c-api/include/wasmtime/_func_class.hh:227–237  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

225 std::enable_if_t<WasmHostFunc<F>::Params::valid, bool> = true,
226 std::enable_if_t<WasmHostFunc<F>::Results::valid, bool> = true>
227 static Func wrap(Store::Context cx, F f) {
228 using HostFunc = WasmHostFunc<F>;
229 auto params = HostFunc::Params::types();
230 auto results = HostFunc::Results::types();
231 auto ty = FuncType::from_iters(params, results);
232 wasmtime_func_t func;
233 wasmtime_func_new_unchecked(cx.ptr, ty.ptr.get(), raw_callback_unchecked<F>,
234 std::make_unique<F>(f).release(),
235 raw_finalize<F>, &func);
236 return func;
237 }
238
239 /**
240 * \brief Invoke a WebAssembly function.

Callers

nothing calls this directly

Calls 4

typesFunction · 0.85
releaseMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected