Skip to main content

Crate graphrt_wasm

Crate graphrt_wasm 

Source
Expand description

§graphrt-wasm

Sandboxed WebAssembly plugins that add node kinds to a graphrt Registry.

  • Portable: one .wasm file runs on every OS and CPU the host runs on.
  • Sandboxed: guests run in the pure-Rust wasmi interpreter with a fuel (CPU) budget, a memory cap, bounded I/O buffers and no system access. The only imports are graphrt::log, graphrt::chunk and graphrt::progress.
  • Stateless: every run gets a fresh instance.
  • Small: wasmi adds well under a megabyte to a release binary.
use graphrt_core::Registry;
use graphrt_wasm::{WasmLimits, WasmPlugin};

let plugin = WasmPlugin::load_file("plugins/text_tools.wasm", WasmLimits::default())?;
let mut registry = Registry::with_builtins();
plugin.register(&mut registry)?; // adds e.g. `slugify` and `word-count`

The guest ABI is documented in abi and in docs/wasm-plugins.md.

Modules§

abi
Wire format exchanged with guest modules (ABI version 1).
resolve
Host-side config resolution before a guest runs.

Structs§

LogLine
One log line written by a guest.
WasmLimits
Limits applied to every guest call. Operators set these; workflow documents cannot raise them.
WasmPlugin
A loaded WebAssembly plugin. Cheap to clone; safe to share across runs and threads.

Enums§

WasmError
Error loading or calling a guest module.