pub trait HostOutputStream: Send + Sync {
    // Required methods
    fn write(&mut self, bytes: Bytes) -> Result<(usize, StreamState), Error>;
    fn ready<'life0, 'async_trait>(
        &'life0 mut self
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided methods
    fn splice(
        &mut self,
        src: &mut dyn HostInputStream,
        nelem: usize
    ) -> Result<(usize, StreamState), Error> { ... }
    fn write_zeroes(
        &mut self,
        nelem: usize
    ) -> Result<(usize, StreamState), Error> { ... }
}
Expand description

Host trait for implementing the wasi:io/streams.output-stream resource: A bytestream which can be written to.

Required Methods§

source

fn write(&mut self, bytes: Bytes) -> Result<(usize, StreamState), Error>

Write bytes. On success, returns the number of bytes written. Important: this write must be non-blocking!

source

fn ready<'life0, 'async_trait>( &'life0 mut self ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,

Check for write readiness: this method blocks until the stream is ready for writing.

Provided Methods§

source

fn splice( &mut self, src: &mut dyn HostInputStream, nelem: usize ) -> Result<(usize, StreamState), Error>

Transfer bytes directly from an input stream to an output stream. Important: this splice must be non-blocking!

source

fn write_zeroes(&mut self, nelem: usize) -> Result<(usize, StreamState), Error>

Repeatedly write a byte to a stream. Important: this write must be non-blocking!

Implementors§