Wasmer Runtime
Wasmer is a standalone JIT WebAssembly runtime, aiming to be fully compatible with Emscripten, Rust and Go. Learn more.
This crate represents the high-level runtime API, making embedding WebAssembly in your application easy, efficient, and safe.
How to use Wasmer Runtime
The easiest way is to use the instantiate function to create an
Instance. Then you can use call or func and then
call to call an exported function safely.
Example
Given this WebAssembly:
(module
(type $t0 (func (param i32) (result i32)))
(func $add_one (export "add_one") (type $t0) (param $p0 i32) (result i32)
get_local $p0
i32.const 1
i32.add))
compiled into Wasm bytecode, we can call the exported add_one function:
static WASM: &'static = &;
use ;
Additional Notes
The wasmer-runtime crate is built to support multiple compiler
backends. We support having a Cranelift backend in the
wasmer-clif-backend crate, a LLVM backend in the
[wasmer-llvm-backend] crate, and the Singlepass backend in the
[wasmer-singlepass-backend] crate. Currently, the Cranelift backend
is the default.
You can specify the compiler you wish to use with the compile_with function.