17 releases (7 breaking)

✓ Uses Rust 2018 edition

0.8.0 Oct 2, 2019
0.6.0 Aug 1, 2019
0.5.7 Jul 23, 2019
0.2.1 Feb 28, 2019
Download history 408/week @ 2019-04-18 410/week @ 2019-04-25 337/week @ 2019-05-02 152/week @ 2019-05-09 531/week @ 2019-05-16 586/week @ 2019-05-23 731/week @ 2019-05-30 509/week @ 2019-06-06 515/week @ 2019-06-13 597/week @ 2019-06-20 418/week @ 2019-06-27 600/week @ 2019-07-04 544/week @ 2019-07-11 208/week @ 2019-07-18 184/week @ 2019-07-25

1,403 downloads per month
Used in 7 crates (5 directly)

MIT license

12K SLoC

Wasmer logo

Build Status License Join the Wasmer Community Number of downloads from crates.io Read our API documentation

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.


Given this WebAssembly:

  (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

compiled into Wasm bytecode, we can call the exported add_one function:

static WASM: &'static [u8] = &[
    // The module above compiled to bytecode goes here.
    0x00, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00, 0x01, 0x06, 0x01, 0x60,
    0x01, 0x7f, 0x01, 0x7f, 0x03, 0x02, 0x01, 0x00, 0x07, 0x0b, 0x01, 0x07,
    0x61, 0x64, 0x64, 0x5f, 0x6f, 0x6e, 0x65, 0x00, 0x00, 0x0a, 0x09, 0x01,
    0x07, 0x00, 0x20, 0x00, 0x41, 0x01, 0x6a, 0x0b, 0x00, 0x1a, 0x04, 0x6e,
    0x61, 0x6d, 0x65, 0x01, 0x0a, 0x01, 0x00, 0x07, 0x61, 0x64, 0x64, 0x5f,
    0x6f, 0x6e, 0x65, 0x02, 0x07, 0x01, 0x00, 0x01, 0x00, 0x02, 0x70, 0x30,

use wasmer_runtime::{

fn main() -> error::Result<()> {
    // We're not importing anything, so make an empty import object.
    let import_object = imports! {};

    let mut instance = instantiate(WASM, &import_object)?;

    let values = instance

    assert_eq!(values[0], Value::I32(43));

Additional Notes

The wasmer-runtime crate is build to support multiple compiler backends. Currently, we support the Cranelift compiler with the wasmer-clif-backend crate by default.

You can specify the compiler you wish to use with the compile_with function.


~96K SLoC