Trait wasmtime_wasi_http::poll::Host
source · pub trait Host {
// Required methods
fn drop_pollable(&mut self, this: Pollable) -> Result<()>;
fn poll_oneoff(&mut self, in_: Vec<Pollable>) -> Result<Vec<u8>>;
}
Required Methods§
sourcefn drop_pollable(&mut self, this: Pollable) -> Result<()>
fn drop_pollable(&mut self, this: Pollable) -> Result<()>
Dispose of the specified pollable
, after which it may no longer
be used.
sourcefn poll_oneoff(&mut self, in_: Vec<Pollable>) -> Result<Vec<u8>>
fn poll_oneoff(&mut self, in_: Vec<Pollable>) -> Result<Vec<u8>>
Poll for completion on a set of pollables.
The “oneoff” in the name refers to the fact that this function must do a linear scan through the entire list of subscriptions, which may be inefficient if the number is large and the same subscriptions are used many times. In the future, this is expected to be obsoleted by the component model async proposal, which will include a scalable waiting facility.
Note that the return type would ideally be list<bool>
, but that would
be more difficult to polyfill given the current state of wit-bindgen
.
See https://github.com/bytecodealliance/preview2-prototyping/pull/11#issuecomment-1329873061
for details. For now, we use zero to mean “not ready” and non-zero to
mean “ready”.