[−][src]Trait wapc::ModuleHost
The module host (waPC) must provide an implementation of this trait to the engine provider to enable waPC function calls.
Required methods
fn get_guest_request(&self) -> Option<Invocation>
Called by the engine provider to obtain the Invocation bound for the guest module
fn get_host_response(&self) -> Option<Vec<u8>>
Called by the engine provider to query the results of a host function call
fn set_guest_error(&self, error: String)
Called by the engine provider to set the error message indicating a failure that occurred inside the guest module execution
fn set_guest_response(&self, response: Vec<u8>)
Called by the engine provider to set the response data for a guest call
fn get_host_error(&self) -> Option<String>
Called by the engine provider to query the host error if one is indicated by the return code for a host call
fn do_host_call(
&self,
binding: &str,
namespace: &str,
operation: &str,
payload: &[u8]
) -> Result<i32, Box<dyn Error>>
&self,
binding: &str,
namespace: &str,
operation: &str,
payload: &[u8]
) -> Result<i32, Box<dyn Error>>
Called by the engine provider to allow a guest module to perform a host call. The numeric return value will be > 0 for success (engine must obtain the host response) or 0 for error (engine must obtain the error)
fn do_console_log(&self, msg: &str)
Attempts to perform a console log. There are no guarantees this will happen, and no error will be returned to the guest module if the host rejects the attempt