pub trait AsyncWrite {
// Required methods
fn poll_write(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
buf: &[u8],
) -> Poll<Result<usize>>;
fn poll_flush(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
) -> Poll<Result<()>>;
fn poll_shutdown(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
) -> Poll<Result<()>>;
}Expand description
Async version of std::io::Write.
All three poll methods follow the same contract: Poll::Ready(Ok(...))
on success, Poll::Pending when the underlying resource is not ready
(with the waker arranged to fire when it becomes ready).
Required Methods§
Sourcefn poll_write(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
buf: &[u8],
) -> Poll<Result<usize>>
fn poll_write( self: Pin<&mut Self>, cx: &mut Context<'_>, buf: &[u8], ) -> Poll<Result<usize>>
Attempt to write bytes from buf into the sink.
Returns the number of bytes written. May be less than buf.len().