Trait WasmRuntime

Source
pub trait WasmRuntime<T>: Clone
where T: ProcessState + Default + Send,
{ type WasmInstance: WasmInstance; // Required methods fn compile_module(&mut self, data: RawWasm) -> Result<usize>; fn wasm_module(&self, index: usize) -> Option<&RawWasm>; }
Expand description

A WasmRuntime is a compiler that can generate runnable code from raw .wasm files.

It also provides a mechanism to register host functions that are accessible to the wasm guest code through the generic type T. The type T must implement the ProcessState trait and expose a register function for host functions.

Required Associated Types§

Required Methods§

Source

fn compile_module(&mut self, data: RawWasm) -> Result<usize>

Takes a raw binary WebAssembly module and returns the index of a compiled module.

Source

fn wasm_module(&self, index: usize) -> Option<&RawWasm>

Returns a reference to the raw binary WebAssembly module if the index exists.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§