Struct wapc::ModuleState
source · pub struct ModuleState { /* private fields */ }
Expand description
Module state is essentially a ‘handle’ that is passed to a runtime engine to allow it to read and write relevant data as different low-level functions are executed during a waPC conversation
Implementations§
source§impl ModuleState
impl ModuleState
sourcepub fn get_guest_request(&self) -> Option<Invocation>
pub fn get_guest_request(&self) -> Option<Invocation>
Retrieves the value, if any, of the current guest request
sourcepub fn get_host_response(&self) -> Option<Vec<u8>>
pub fn get_host_response(&self) -> Option<Vec<u8>>
Retrieves the value of the current host response
sourcepub fn set_guest_error(&self, error: String)
pub fn set_guest_error(&self, error: String)
Sets a value indicating that an error occurred inside the execution of a guest call
sourcepub fn set_guest_response(&self, response: Vec<u8>)
pub fn set_guest_response(&self, response: Vec<u8>)
Sets the value indicating the response data from a guest call
sourcepub fn get_guest_response(&self) -> Option<Vec<u8>>
pub fn get_guest_response(&self) -> Option<Vec<u8>>
Queries the value of the current guest response
sourcepub fn get_host_error(&self) -> Option<String>
pub fn get_host_error(&self) -> Option<String>
Queries the value of the current host error
sourcepub fn do_host_call(
&self,
binding: &str,
namespace: &str,
operation: &str,
payload: &[u8]
) -> Result<i32, Box<dyn Error>>
pub fn do_host_call( &self, binding: &str, namespace: &str, operation: &str, payload: &[u8] ) -> Result<i32, Box<dyn Error>>
Invoked when the guest module wishes to make a call on the host
sourcepub fn do_console_log(&self, msg: &str)
pub fn do_console_log(&self, msg: &str)
Invoked when the guest module wants to write a message to the host’s stdout
Trait Implementations§
source§impl Debug for ModuleState
impl Debug for ModuleState
source§impl Default for ModuleState
impl Default for ModuleState
source§fn default() -> ModuleState
fn default() -> ModuleState
Returns the “default value” for a type. Read more