Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Embedding from Rust (and Other Hosts)

The extension ABI is not tied to Java. An extension declares its contract in build.rs with the boomslang-hostgen DSL and emits ABI JSON; host-language adapters are generated from that JSON. Any WASM runtime that implements the same imports can run boomslang.wasm.

Host languageStatusRuntimeHost adapter support
JavaPrimary hostChicoryStock runtime API, HostBridge, generated Java adapters
PythonSupported host packageWasmtime (wasmtime-py)boomslang-py wheel with the Sandbox API
RustSupported example hostWasmtimeGenerated Rust adapters; see below
Other languagesABI targetAny WASM runtime with compatible importsImplement the ABI JSON contract directly

The Rust example host

examples/rust-host/ is a runnable Wasmtime embedder. Its build.rs turns an <extension>.abi.json into typed Wasmtime bindings:

cargo run --manifest-path examples/rust-host/Cargo.toml

The generated binding is a typed builder plus a register(&mut wasmtime::Linker<_>):

#![allow(unused)]
fn main() {
let host = BoomslangHostHostFunctions::builder()
    .with_call(|name, payload| Ok(format!("{name}: {payload}")))
    .with_log(|level, message| {
        eprintln!("[guest log:{level}] {message}");
        Ok(())
    })
    .build();

host.register(&mut linker)?;
}

Generated Rust host bindings also include an AsyncHostRegistry mirroring the Java one: typed async imports return registry tokens, and the stock call handler routes the reserved __async_* control calls through the same registry.

Embedding a full boomslang.wasm

The generated register covers the extension imports. A complete embedder additionally:

  1. adds WASI preview1 imports to the same Linker
  2. instantiates the module
  3. drives execution through boomslang’s exported functions (alloc, compile_source, execute, and the output-buffer protocol)

The exported function contract is specified in the reference section (base ABI). Runtime assets (boomslang.wasm + the Python resource tree) are published on GitHub Releases — see Installation.