[−][src]Macro wasmer_runtime::func
Helper macro to create a new Func object using the provided function pointer.
Usage
Function pointers or closures are supported. Closures can capture
their environment (with move). The first parameter is of kind
vm::Ctx.
// A host function. fn func(ctx: &mut vm::Ctx, n: i32) -> i32 { n } let i = 7; let import_object = imports! { "env" => { "foo" => func!(func), // A closure with a captured environment. "bar" => func!(move |_: &mut vm::Ctx, n: i32| -> i32 { n + i }), }, };