ModuleStateAsync

Struct ModuleStateAsync 

Source
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

Source

pub async fn get_guest_request(&self) -> Option<Invocation>

Retrieves the value, if any, of the current guest request

Source

pub async fn get_host_response(&self) -> Option<Vec<u8>>

Retrieves the value of the current host response

Source

pub async fn set_guest_error(&self, error: String)

Sets a value indicating that an error occurred inside the execution of a guest call

Source

pub async fn set_guest_response(&self, response: Vec<u8>)

Sets the value indicating the response data from a guest call

Source

pub async fn get_guest_response(&self) -> Option<Vec<u8>>

Queries the value of the current guest response

Source

pub async fn get_host_error(&self) -> Option<String>

Queries the value of the current host error

Source

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

Source

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

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ModuleStateAsync

Source§

fn default() -> ModuleStateAsync

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.