WebAssemblyEngineProviderAsync

Trait WebAssemblyEngineProviderAsync 

Source
pub trait WebAssemblyEngineProviderAsync {
    // Required methods
    fn init<'life0, 'async_trait>(
        &'life0 mut self,
        host: Arc<ModuleStateAsync>,
    ) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error + Send + Sync>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn call<'life0, 'async_trait>(
        &'life0 mut self,
        op_length: i32,
        msg_length: i32,
    ) -> Pin<Box<dyn Future<Output = Result<i32, Box<dyn Error + Send + Sync>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn replace<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        bytes: &'life1 [u8],
    ) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error + Send + Sync>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Available on crate feature async only.
Expand description

An async engine provider is any code that encapsulates low-level WebAssembly interactions such as reading from and writing to linear memory, executing functions, and mapping imports in a way that conforms to the waPC conversation protocol.

Required Methods§

Source

fn init<'life0, 'async_trait>( &'life0 mut self, host: Arc<ModuleStateAsync>, ) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error + Send + Sync>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Tell the engine provider that it can do whatever processing it needs to do for initialization and give it access to the module state

Source

fn call<'life0, 'async_trait>( &'life0 mut self, op_length: i32, msg_length: i32, ) -> Pin<Box<dyn Future<Output = Result<i32, Box<dyn Error + Send + Sync>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Trigger the waPC function call. Engine provider is responsible for execution and using the appropriate methods on the module host. When this function is complete, the guest response and optionally the guest error must be set to represent the high-level call result

Source

fn replace<'life0, 'life1, 'async_trait>( &'life0 mut self, bytes: &'life1 [u8], ) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error + Send + Sync>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Called by the host to replace the WebAssembly module bytes of the previously initialized module. Engine must return an error if it does not support bytes replacement.

Implementors§