pub(super) fn generic_copy<R, W>(reader: &mut R, writer: &mut W) -> Result<u64>🔬This is a nightly-only experimental API. (
alloc_io #154046)Expand description
The userspace read-write-loop implementation of io::copy that is used when
OS-specific specializations for copy offloading are not available or not applicable.
This function is able to perform a mild amount of specialization based on
the size of the reader and writer buffers, if they have any.
- If
reader’s buffer is large enough (>=DEFAULT_BUF_SIZE), and it is larger thanwriter’s buffer, copying will be controlled byR. - Otherwise, copying will be controlled by
writer.
Currently, [u8], Vec<u8>, VecDeque<u8>, BufReader<T> and BufWriter<T>
are specialized with.