Struct wasmtime_wasi::pipe::AsyncWriteStream
source · pub struct AsyncWriteStream { /* private fields */ }
Expand description
Provides a HostOutputStream
impl from a tokio::io::AsyncWrite
impl
Implementations§
source§impl AsyncWriteStream
impl AsyncWriteStream
sourcepub fn new<T: AsyncWrite + Send + Unpin + 'static>(
write_budget: usize,
writer: T,
) -> Self
pub fn new<T: AsyncWrite + Send + Unpin + 'static>( write_budget: usize, writer: T, ) -> Self
Create a AsyncWriteStream
. In order to use the HostOutputStream
impl
provided by this struct, the argument must impl tokio::io::AsyncWrite
.
Trait Implementations§
source§impl HostOutputStream for AsyncWriteStream
impl HostOutputStream for AsyncWriteStream
source§fn write(&mut self, bytes: Bytes) -> Result<(), StreamError>
fn write(&mut self, bytes: Bytes) -> Result<(), StreamError>
Write bytes after obtaining a permit to write those bytes Read more
source§fn flush(&mut self) -> Result<(), StreamError>
fn flush(&mut self) -> Result<(), StreamError>
Trigger a flush of any bytes buffered in this stream implementation. Read more
source§fn check_write(&mut self) -> Result<usize, StreamError>
fn check_write(&mut self) -> Result<usize, StreamError>
Returns the number of bytes that are ready to be written to this stream. Read more
source§fn cancel<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn cancel<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Cancel any asynchronous work and wait for it to wrap up.
source§fn blocking_write_and_flush<'life0, 'async_trait>(
&'life0 mut self,
bytes: Bytes,
) -> Pin<Box<dyn Future<Output = StreamResult<()>> + Send + 'async_trait>>where
Self: Send + 'async_trait,
'life0: 'async_trait,
fn blocking_write_and_flush<'life0, 'async_trait>(
&'life0 mut self,
bytes: Bytes,
) -> Pin<Box<dyn Future<Output = StreamResult<()>> + Send + 'async_trait>>where
Self: Send + 'async_trait,
'life0: 'async_trait,
Perform a write of up to 4096 bytes, and then flush the stream. Block
until all of these operations are complete, or an error occurs. Read more
source§fn write_zeroes(&mut self, nelem: usize) -> StreamResult<()>
fn write_zeroes(&mut self, nelem: usize) -> StreamResult<()>
Repeatedly write a byte to a stream.
Important: this write must be non-blocking!
Returning an Err which downcasts to a
StreamError
will be
reported to Wasm as the empty error result. Otherwise, errors will trap.source§fn blocking_write_zeroes_and_flush<'life0, 'async_trait>(
&'life0 mut self,
nelem: usize,
) -> Pin<Box<dyn Future<Output = StreamResult<()>> + Send + 'async_trait>>where
Self: Send + 'async_trait,
'life0: 'async_trait,
fn blocking_write_zeroes_and_flush<'life0, 'async_trait>(
&'life0 mut self,
nelem: usize,
) -> Pin<Box<dyn Future<Output = StreamResult<()>> + Send + 'async_trait>>where
Self: Send + 'async_trait,
'life0: 'async_trait,
Perform a write of up to 4096 zeroes, and then flush the stream.
Block until all of these operations are complete, or an error
occurs. Read more
source§fn write_ready<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = StreamResult<usize>> + Send + 'async_trait>>where
Self: Send + 'async_trait,
'life0: 'async_trait,
fn write_ready<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = StreamResult<usize>> + Send + 'async_trait>>where
Self: Send + 'async_trait,
'life0: 'async_trait,
Simultaneously waits for this stream to be writable and then returns how
much may be written or the last error that happened.
source§impl Subscribe for AsyncWriteStream
impl Subscribe for AsyncWriteStream
Auto Trait Implementations§
impl Freeze for AsyncWriteStream
impl RefUnwindSafe for AsyncWriteStream
impl Send for AsyncWriteStream
impl Sync for AsyncWriteStream
impl Unpin for AsyncWriteStream
impl UnwindSafe for AsyncWriteStream
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> GetSetFdFlags for T
impl<T> GetSetFdFlags for T
source§fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
Query the “status” flags for the
self
file descriptor.source§fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
source§fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: AsFilelike,
fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: AsFilelike,
Set the “status” flags for the
self
file descriptor. Read moresource§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more