Trait wasmtime_wasi::preview2::stream::InputStream
source · pub trait InputStream: Send + Sync {
// Required methods
fn as_any(&self) -> &dyn Any;
fn readable<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
// Provided methods
fn pollable_read(&self) -> Option<BorrowedFd<'_>> { ... }
fn read<'life0, 'life1, 'async_trait>(
&'life0 mut self,
_buf: &'life1 mut [u8]
) -> Pin<Box<dyn Future<Output = Result<(u64, bool), Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn read_vectored<'a, 'life0, 'life1, 'async_trait>(
&'life0 mut self,
_bufs: &'life1 mut [IoSliceMut<'a>]
) -> Pin<Box<dyn Future<Output = Result<(u64, bool), Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'a: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn is_read_vectored(&self) -> bool { ... }
fn skip<'life0, 'async_trait>(
&'life0 mut self,
nelem: u64
) -> Pin<Box<dyn Future<Output = Result<(u64, bool), Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn num_ready_bytes<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<u64, Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
}
Expand description
An input bytestream.
This is “pseudo” because the real streams will be a type in wit, and built into the wit bindings, and will support async and type parameters. This pseudo-stream abstraction is synchronous and only supports bytes.
Required Methods§
Provided Methods§
sourcefn pollable_read(&self) -> Option<BorrowedFd<'_>>
fn pollable_read(&self) -> Option<BorrowedFd<'_>>
If this stream is reading from a host file descriptor, return it so that it can be polled with a host poll.
sourcefn read<'life0, 'life1, 'async_trait>(
&'life0 mut self,
_buf: &'life1 mut [u8]
) -> Pin<Box<dyn Future<Output = Result<(u64, bool), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn read<'life0, 'life1, 'async_trait>( &'life0 mut self, _buf: &'life1 mut [u8] ) -> Pin<Box<dyn Future<Output = Result<(u64, bool), Error>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,
Read bytes. On success, returns a pair holding the number of bytes read and a flag indicating whether the end of the stream was reached.
sourcefn read_vectored<'a, 'life0, 'life1, 'async_trait>(
&'life0 mut self,
_bufs: &'life1 mut [IoSliceMut<'a>]
) -> Pin<Box<dyn Future<Output = Result<(u64, bool), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'a: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn read_vectored<'a, 'life0, 'life1, 'async_trait>( &'life0 mut self, _bufs: &'life1 mut [IoSliceMut<'a>] ) -> Pin<Box<dyn Future<Output = Result<(u64, bool), Error>> + Send + 'async_trait>>where Self: 'async_trait, 'a: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,
Vectored-I/O form of read
.
sourcefn is_read_vectored(&self) -> bool
fn is_read_vectored(&self) -> bool
Test whether vectored I/O reads are known to be optimized in the underlying implementation.