#wasi #wasmtime #automatic #version #linker #detect #auto

auto-wasi

Automatic WASI version detection and linking for wasmtime

1 unstable release

0.1.0 Jan 23, 2021

#73 in #auto

Unlicense

6KB
66 lines

auto-wasi

Automatic WASI version detection and linking for wasmtime.


lib.rs:

Wrapper around wasmtime-wasi that automatically detects the WASI version used by the module.

Example

let wat = r#"
(module
    (type $empty (func))
    ;; In the real world this would be an actual wasi import,
    ;; but this crate only checks the module name.
    (import "wasi_snapshot_preview1" "" (func (type $empty)))
 )
"#;
let store = Store::default();
let ctx = WasiCtx::new(std::env::args())?;

let wasm = wat::parse_str(wat)?;
let wasi = AutoWasi::detect(&store, ctx, wasm)?;

Dependencies

~21–32MB
~530K SLoC