pub trait WasiRuntimeImplementation: Debug + Sync {
// Required methods
fn bus(&self) -> &dyn VirtualBus;
fn networking(&self) -> &dyn VirtualNetworking;
fn thread_generate_id(&self) -> WasiThreadId;
// Provided methods
fn tty_get(&self) -> WasiTtyState { ... }
fn tty_set(&self, _tty_state: WasiTtyState) { ... }
fn thread_spawn(
&self,
_callback: Box<dyn FnOnce() + Send + 'static>,
) -> Result<(), WasiThreadError> { ... }
fn thread_parallelism(&self) -> Result<usize, WasiThreadError> { ... }
fn yield_now(&self, _id: WasiThreadId) -> Result<(), WasiError> { ... }
fn getpid(&self) -> Option<u32> { ... }
}
Expand description
Represents an implementation of the WASI runtime - by default everything is unimplemented.
Required Methods§
Sourcefn bus(&self) -> &dyn VirtualBus
fn bus(&self) -> &dyn VirtualBus
For WASI runtimes that support it they can implement a message BUS implementation which allows runtimes to pass serialized messages between each other similar to RPC’s. BUS implementation can be implemented that communicate across runtimes thus creating a distributed computing architecture.
Sourcefn networking(&self) -> &dyn VirtualNetworking
fn networking(&self) -> &dyn VirtualNetworking
Provides access to all the networking related functions such as sockets. By default networking is not implemented.
Sourcefn thread_generate_id(&self) -> WasiThreadId
fn thread_generate_id(&self) -> WasiThreadId
Generates a new thread ID
Provided Methods§
Sourcefn tty_get(&self) -> WasiTtyState
fn tty_get(&self) -> WasiTtyState
Gets the TTY state
Sourcefn tty_set(&self, _tty_state: WasiTtyState)
fn tty_set(&self, _tty_state: WasiTtyState)
Sets the TTY state
Sourcefn thread_spawn(
&self,
_callback: Box<dyn FnOnce() + Send + 'static>,
) -> Result<(), WasiThreadError>
fn thread_spawn( &self, _callback: Box<dyn FnOnce() + Send + 'static>, ) -> Result<(), WasiThreadError>
Spawns a new thread by invoking the
Sourcefn thread_parallelism(&self) -> Result<usize, WasiThreadError>
fn thread_parallelism(&self) -> Result<usize, WasiThreadError>
Returns the amount of parallelism that is possible on this platform