Trait marine_wasm_backend_traits::WasmBackend

source ·
pub trait WasmBackend: Clone + Send + Sync + '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_async() -> 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§

source

type Store: Store<Self>

A type that stores all the data, while most of the types are handles to data from Store.

source

type Module: Module<Self>

A compiled, but not instantiated module.

source

type Imports: Imports<Self>

An object that holds all the functions that are given to Module as imports.

source

type Instance: Instance<Self>

An instantiated module ready to be executed.

source

type Context<'c>: Context<Self>

A temporary immutable handle to Store.

source

type ContextMut<'c>: ContextMut<Self>

A temporary mutable handle to Store

source

type ImportCallContext<'c>: ImportCallContext<Self>

A type that is used to pass context to imports.

source

type HostFunction: HostFunction<Self> + FuncConstructor<Self>

A host function prepared to be used as import for instantiating a module, contained in Store.

source

type ExportFunction: ExportFunction<Self>

An export function from a wasm instance, contained in Store

source

type Memory: Memory<Self>

A wasm memory.

source

type MemoryView: MemoryView<DelayedContextLifetime<Self>>

A view to the wasm memory.

source

type Wasi: WasiImplementation<Self>

Type that provides all WASI-related APIs.

Required Methods§

source

fn new_async() -> WasmBackendResult<Self>

Creates a new wasm backend with default configuration. In future, a configuration may be passed as argument. The only option at the moment is an asynchronous backend.

Object Safety§

This trait is not object safe.

Implementors§