Function tokio_copy_with_buffer::copy [] [src]

pub fn copy<R, W>(reader: R, writer: W) -> Copy<R, W> where
    R: AsyncRead,
    W: AsyncWrite

Creates a future which represents copying all the bytes from one object to another, just like the original copy function. This version uses large buffer (65536) by default, unlike 4096 as in the original.

The returned future will copy all the bytes read from reader into the writer specified. This future will only complete once the reader has hit EOF and all bytes have been written to and flushed from the writer provided.

On success the number of bytes is returned and the reader and writer are consumed. Additionally the buffer used for copying is also returned. On error the error is returned and the I/O objects are consumed as well.