Skip to main content

copy_with_size

Function copy_with_size 

Source
pub async fn copy_with_size<R, W>(
    reader: &mut R,
    writer: &mut W,
    buf_size: usize,
) -> 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 with specified buffer sizes.

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.