[][src]Trait wapc::WebAssemblyEngineProvider

pub trait WebAssemblyEngineProvider {
    fn init(&mut self, host: Arc<ModuleState>) -> Result<(), Box<dyn Error>>;
fn call(
        &mut self,
        op_length: i32,
        msg_length: i32
    ) -> Result<i32, Box<dyn Error>>;
fn replace(&mut self, bytes: &[u8]) -> Result<(), Box<dyn Error>>; }

An 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

fn init(&mut self, host: Arc<ModuleState>) -> Result<(), Box<dyn Error>>

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

fn call(
    &mut self,
    op_length: i32,
    msg_length: i32
) -> Result<i32, Box<dyn Error>>

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

fn replace(&mut self, bytes: &[u8]) -> Result<(), Box<dyn Error>>

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.

Loading content...

Implementors

Loading content...