pub async fn copy<R: AsyncRead, W: AsyncWrite>(
reader: &mut R,
writer: &mut W,
) -> Result<u64>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 KB is created to take data from the reader to the writer.