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
Auto Trait Implementations§
impl !Freeze for ModuleState
impl !RefUnwindSafe for ModuleState
impl Send for ModuleState
impl Sync for ModuleState
impl Unpin for ModuleState
impl !UnwindSafe for ModuleState
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more