ya-runtime-wasi
This crate allows you to embed [Yagna] WASI runtime inside your application.
The usage is pretty straightforward. In your Cargo.toml
, put ya-runtime-wasi
as your dependency
```toml
[dependencies] ya-runtime-wasi = "0.2" ```
You can now embed the runtime in your app like so
```rust use std::path::Path; use yaruntimewasi::*;
// In this example, we assume that package.zip
contains a WASI binary
// called hello.wasm
, and maps input/output to /workdir
let workspace = Path::new("workspace");
let module_name = "hello.wasm";
let package = Path::new("package.zip");
// Deploy package deploy(&workspace, &package).unwrap();
// Start the runtime start(&workspace).unwrap();
// Execute the binary run( &workspace, &modulename, vec![ "/workdir/input".tostring(), "/workdir/output".to_string(), ], ).unwrap(); ```
A good example of using ya-runtime-wasi
embedding API can be found in the [gfaas
] crate.