Trait Host

pub trait Host: Sized + HostPollable {
    // Required method
    fn poll(
        &mut self,
        in_: Vec<Resource<DynPollable>>,
    ) -> Result<Vec<u32>, Error>;
}

Required Methods§

fn poll(&mut self, in_: Vec<Resource<DynPollable>>) -> Result<Vec<u32>, Error>

Poll for completion on a set of pollables.

This function takes a list of pollables, which identify I/O sources of interest, and waits until one or more of the events is ready for I/O.

The result list<u32> contains one or more indices of handles in the argument list that is ready for I/O.

This function traps if either:

  • the list is empty, or:
  • the list contains more elements than can be indexed with a u32 value.

A timeout can be implemented by adding a pollable from the wasi-clocks API to the list.

This function does not return a result; polling in itself does not do any I/O so it doesn’t fail. If any of the I/O sources identified by the pollables has an error, it is indicated by marking the source as being ready for I/O.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

§

impl<T> Host for IoImpl<T>
where T: IoView,

§

fn poll( &mut self, pollables: Vec<Resource<DynPollable>>, ) -> Result<Vec<u32>, Error>

§

impl<_T> Host for &mut _T
where _T: Host + ?Sized,

§

fn poll(&mut self, in_: Vec<Resource<DynPollable>>) -> Result<Vec<u32>, Error>

Poll for completion on a set of pollables.

This function takes a list of pollables, which identify I/O sources of interest, and waits until one or more of the events is ready for I/O.

The result list<u32> contains one or more indices of handles in the argument list that is ready for I/O.

This function traps if either:

  • the list is empty, or:
  • the list contains more elements than can be indexed with a u32 value.

A timeout can be implemented by adding a pollable from the wasi-clocks API to the list.

This function does not return a result; polling in itself does not do any I/O so it doesn’t fail. If any of the I/O sources identified by the pollables has an error, it is indicated by marking the source as being ready for I/O.

Implementors§