Skip to main content

WasmModule

Trait WasmModule 

Source
pub trait WasmModule:
    Send
    + Sync
    + 'static {
    // Required methods
    fn metadata(&self) -> ModuleMetadata;
    fn start<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn stop<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided method
    fn instantiate<'life0, 'async_trait>(
        &'life0 mut self,
        _bus: MessageBus,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
}
Expand description

Trait implemented by WebAssembly plugins.

Right now the trait is a thin placeholder: it mirrors Module but uses a distinct identity so the manager can keep native and WASM modules separate and apply different sandboxing/security policies later (e.g. wasmtime engine configuration, capability gating).

Required Methods§

Source

fn metadata(&self) -> ModuleMetadata

Static module metadata. The kind field should be ModuleKind::Wasm.

Source

fn start<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Start the WASM module’s main entry point.

Source

fn stop<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Stop and tear down the WASM instance.

Provided Methods§

Source

fn instantiate<'life0, 'async_trait>( &'life0 mut self, _bus: MessageBus, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Instantiate the WASM module inside the host runtime.

Implementors§