pub trait WasmBackend: Clone + Default + 'static {
type Store: Store<Self>;
type Module: Module<Self>;
type Imports: Imports<Self>;
type Instance: Instance<Self>;
type Context<'c>: Context<Self>;
type ContextMut<'c>: ContextMut<Self>;
type ImportCallContext<'c>: ImportCallContext<Self>;
type HostFunction: HostFunction<Self> + FuncConstructor<Self>;
type ExportFunction: ExportFunction<Self>;
type Memory: Memory<Self>;
type MemoryView: MemoryView<DelayedContextLifetime<Self>>;
type Wasi: WasiImplementation<Self>;
// Required method
fn new() -> WasmBackendResult<Self>;
}
Expand description
A core trait for any backend. It serves two purposes:
- handles initialization of the library if needed
- provides access to all public types – like
mod
but for trait impls.
Required Associated Types§
sourcetype Store: Store<Self>
type Store: Store<Self>
A type that stores all the data, while most of the types are handles to data from Store
.
sourcetype Imports: Imports<Self>
type Imports: Imports<Self>
An object that holds all the functions that are given to Module
as imports.
sourcetype ContextMut<'c>: ContextMut<Self>
type ContextMut<'c>: ContextMut<Self>
A temporary mutable handle to Store
sourcetype ImportCallContext<'c>: ImportCallContext<Self>
type ImportCallContext<'c>: ImportCallContext<Self>
A type that is used to pass context to imports.
sourcetype HostFunction: HostFunction<Self> + FuncConstructor<Self>
type HostFunction: HostFunction<Self> + FuncConstructor<Self>
A host function prepared to be used as import for instantiating a module, contained in Store
.
sourcetype ExportFunction: ExportFunction<Self>
type ExportFunction: ExportFunction<Self>
An export function from a wasm instance, contained in Store
sourcetype MemoryView: MemoryView<DelayedContextLifetime<Self>>
type MemoryView: MemoryView<DelayedContextLifetime<Self>>
A view to the wasm memory.
sourcetype Wasi: WasiImplementation<Self>
type Wasi: WasiImplementation<Self>
Type that provides all WASI-related APIs.
Required Methods§
sourcefn new() -> WasmBackendResult<Self>
fn new() -> WasmBackendResult<Self>
Creates a new wasm backend with default configuration. In future, a configuration may be passed as argument.
Object Safety§
This trait is not object safe.