copy

Function copy 

pub async fn copy<R, W>(reader: &mut R, writer: &mut W) -> Result<u64, Error>
where R: AsyncRead, W: AsyncWrite,
Available on crate feature io only.
Expand description

Asynchronously copies the entire contents of a reader into a writer.

This function returns a future that will continuously read data from reader and then write it into writer in a streaming fashion until reader returns EOF or fails.

On success, the total number of bytes that were copied from reader to writer is returned.

This is an asynchronous version of std::io::copy.

A heap-allocated copy buffer with 8 KiB is created to take data from the reader to the writer.