Trait Write
trait Write
Write bytes asynchronously.
This trait is similar to std::io::Write, but for asynchronous writes.
Required Methods
fn poll_write(self: Pin<&mut Self>, cx: &mut Context<'_>, buf: &[u8]) -> Poll<Result<usize, Error>>Attempt to write bytes from
bufinto the destination.On success, returns
Poll::Ready(Ok(num_bytes_written))). If successful, it must be guaranteed thatn <= buf.len(). A return value of0means that the underlying object is no longer able to accept bytes, or that the provided buffer is empty.If the object is not ready for writing, the method returns
Poll::Pendingand arranges for the current task (viacx.waker()) to receive a notification when the object becomes writable or is closed.fn poll_flush(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<(), Error>>Attempts to flush the object.
On success, returns
Poll::Ready(Ok(())).If flushing cannot immediately complete, this method returns
Poll::Pendingand arranges for the current task (viacx.waker()) to receive a notification when the object can make progress.fn poll_shutdown(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<(), Error>>Attempts to shut down this writer.
Provided Methods
fn is_write_vectored(self: &Self) -> boolReturns whether this writer has an efficient
poll_write_vectoredimplementation.The default implementation returns
false.fn poll_write_vectored(self: Pin<&mut Self>, cx: &mut Context<'_>, bufs: &[IoSlice<'_>]) -> Poll<Result<usize, Error>>Like
poll_write, except that it writes from a slice of buffers.