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

Method func_new

crates/wasmtime/src/runtime/linker.rs:428–439  ·  view source on GitHub ↗

Creates a [`Func::new`]-style function named in this linker. For more information see [`Linker::func_wrap`]. # Panics Panics if the given function type is not associated with the same engine as this linker. # Errors This function will return an [`OutOfMemory`][crate::OutOfMemory] error when memory allocation fails. See the `OutOfMemory` type's documentation for details on Wasmtime's out-of-me

(
        &mut self,
        module: &str,
        name: &str,
        ty: FuncType,
        func: impl Fn(Caller<'_, T>, &[Val], &mut [Val]) -> Result<()> + Send + Sync + 'static,
    )

Source from the content-addressed store, hash-verified

426 /// memory allocation fails. See the `OutOfMemory` type's documentation for
427 /// details on Wasmtime's out-of-memory handling.
428 pub fn func_new(
429 &mut self,
430 module: &str,
431 name: &str,
432 ty: FuncType,
433 func: impl Fn(Caller<'_, T>, &[Val], &mut [Val]) -> Result<()> + Send + Sync + 'static,
434 ) -> Result<&mut Self>
435 where
436 T: 'static,
437 {
438 self.func_insert(module, name, HostFunc::new(&self.engine, ty, func)?)
439 }
440
441 /// Creates a [`Func::new_unchecked`]-style function named in this linker.
442 ///

Callers 15

bench_callsFunction · 0.45
new_from_signatureFunction · 0.45
func_return_nothingFunction · 0.45
make_envFunction · 0.45
native_loads_and_storesFunction · 0.45
map_trampoline_alignmentFunction · 0.45

Calls 2

func_insertMethod · 0.80
newFunction · 0.50