Skip to main content

Module wasm

Module wasm 

Source
Expand description

WASM plugin traits for compiling, instantiating, and calling WASM modules.

These traits abstract over a concrete WASM runtime (e.g. wasmtime) so the plugin host can work with any backend. The pd-wasm-wasmtime crate provides the production implementation via WasmtimeHost.

§Design notes

  • WasmImports closures have + Send + Sync + 'static bounds so they can be registered as wasmtime host functions, which require Send + Sync. WasmActor (Phase 5.6) uses Arc<Mutex<…>> for the outbox buffer.
  • WasmModule exposes as_any() so the concrete WasmHost can downcast the Box<dyn WasmModule> it created back to its own type without a separate runtime registry.

Structs§

WasmImports
Host function callbacks injected into a WASM module at instantiation.

Enums§

WasmError
Errors that can occur during WASM module compilation, instantiation, or execution.
WasmVal
A WASM numeric value, used for function call arguments and return values.

Traits§

WasmHost
Factory for compiling and instantiating WASM modules.
WasmInstance
A fully instantiated WASM module, ready to execute exported functions.
WasmModule
A compiled (but not yet instantiated) WASM module.