read_write_ext_tokio

Trait AsyncReadWriteExt

Source
pub trait AsyncReadWriteExt:
    AsyncRead
    + AsyncWrite
    + Unpin {
    // Provided methods
    fn chain_after<R: AsyncRead>(
        &mut self,
        reader: R,
    ) -> AsyncReadWriteChain<R, &mut Self> { ... }
    fn take_rw(&mut self, len: u64) -> AsyncReadWriteTake<&mut Self> { ... }
}

Provided Methods§

Source

fn chain_after<R: AsyncRead>( &mut self, reader: R, ) -> AsyncReadWriteChain<R, &mut Self>

Returns a struct that implements tokio::io::AsyncRead and tokio::io::AsyncWrite.

It reads from reader until it is empty, then reads from self.

It passes all writes through to self.

This is like tokio::io::AsyncReadExt::chain that also passes through writes.

Source

fn take_rw(&mut self, len: u64) -> AsyncReadWriteTake<&mut Self>

Wraps a struct that implements tokio::io::AsyncRead and tokio::io::AsyncWrite.

The returned struct passes through reads and writes to the struct.

It limits the number of bytes that can be read.

This is like tokio::io::AsyncReadExt::take that also passes through writes.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§