pub trait AsyncWrite {
// Required method
fn poll_write(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
buf: &[u8],
) -> Poll<Result<usize>>;
}Expand description
Writes bytes into a destination.
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 buf into the destination.
Generally, an implementation will perform a copy.
On success, it returns Ok(num_bytes_written), that is the number
of bytes written.
Note that, it is possible that not the entire buf will be written (for instance,
because of a mechanism of flow controller or limited capacity).
An implementation SHOULD never return Ok(0) if buf is not empty.
An implementation SHOULD only generates the following errors:
std::io::ErrorKind::ConnectionResetif the write operation was explicitly stopped by the destination.std::io::ErrorKind::NotConnectedif the write operation aborted at any point because lack of communication with the destination.