AsyncWrite

Trait AsyncWrite 

Source
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§

Source

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:

Implementations on Foreign Types§

Source§

impl AsyncWrite for Vec<u8>

Source§

fn poll_write( self: Pin<&mut Self>, _cx: &mut Context<'_>, buf: &[u8], ) -> Poll<Result<usize>>

Implementors§