wasm3 0.1.0

Rust bindings for blend2d
docs.rs failed to build wasm3-0.1.0
Please check the build logs and, if you believe this is docs.rs' fault, open an issue.
Visit the last successful build: wasm3-0.1.1

wasm3-rs

Build Tokei Crates.io Docs.rs

Rust wrapper for WASM3.

This is currently work in progress and may or may not be entirely sound.

Sample

A simple example that loads a wasm module and executes an exported function to add two i64s together.

use wasm3::Environment;
use wasm3::Module;

fn main() {
    let env = Environment::new().expect("Unable to create environment");
    let rt = env
        .create_runtime(1024 * 60)
        .expect("Unable to create runtime");
    let module = Module::parse(&env, &include_bytes!("wasm/wasm_add/wasm_add.wasm")[..])
        .expect("Unable to parse module");

    let module = rt.load_module(module).expect("Unable to load module");
    let func = module
        .find_function::<(i64, i64), i64>("add")
        .expect("Unable to find function");
    println!("Wasm says that 3 + 6 is {}", func.call(3, 6).unwrap())
}

Building

This crate currently does not make use of the cmake project of wasm3, meaning cmake is not required to built this for the time being. It does however require Clang 9 to be installed as well as Bindgen.

The reason for having bindgen not be part of the build-dependencies is to cut down transitive dependencies as well as due to a bug in cargo pulling in more features of dependencies if used in build-deps.

License

Licensed under the MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)