pub trait WasmRuntime<T>: Clonewhere
    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.

Implementors§