pub struct ModuleStateAsync { /* private fields */ }Available on crate feature
async only.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
This version of ModuleState is designed for use in async contexts
Implementations§
Source§impl ModuleStateAsync
impl ModuleStateAsync
Sourcepub async fn get_guest_request(&self) -> Option<Invocation>
pub async fn get_guest_request(&self) -> Option<Invocation>
Retrieves the value, if any, of the current guest request
Sourcepub async fn get_host_response(&self) -> Option<Vec<u8>>
pub async fn get_host_response(&self) -> Option<Vec<u8>>
Retrieves the value of the current host response
Sourcepub async fn set_guest_error(&self, error: String)
pub async fn set_guest_error(&self, error: String)
Sets a value indicating that an error occurred inside the execution of a guest call
Sourcepub async fn set_guest_response(&self, response: Vec<u8>)
pub async fn set_guest_response(&self, response: Vec<u8>)
Sets the value indicating the response data from a guest call
Sourcepub async fn get_guest_response(&self) -> Option<Vec<u8>>
pub async fn get_guest_response(&self) -> Option<Vec<u8>>
Queries the value of the current guest response
Sourcepub async fn get_host_error(&self) -> Option<String>
pub async fn get_host_error(&self) -> Option<String>
Queries the value of the current host error
Sourcepub async fn do_host_call(
&self,
binding: String,
namespace: String,
operation: String,
payload: Vec<u8>,
) -> Result<i32, Box<dyn Error>>
pub async fn do_host_call( &self, binding: String, namespace: String, operation: String, payload: Vec<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 ModuleStateAsync
impl Debug for ModuleStateAsync
Source§impl Default for ModuleStateAsync
impl Default for ModuleStateAsync
Source§fn default() -> ModuleStateAsync
fn default() -> ModuleStateAsync
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !Freeze for ModuleStateAsync
impl !RefUnwindSafe for ModuleStateAsync
impl Send for ModuleStateAsync
impl Sync for ModuleStateAsync
impl Unpin for ModuleStateAsync
impl !UnwindSafe for ModuleStateAsync
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