pub async fn copy_bidirectional<A, B>(
reader: A,
writer: B,
) -> (Result<u64, Error>, Result<u64, Error>)where
A: Splittable,
<A as Splittable>::ReadHalf: AsyncRead,
<A as Splittable>::WriteHalf: AsyncWrite,
B: Splittable,
<B as Splittable>::ReadHalf: AsyncRead,
<B as Splittable>::WriteHalf: AsyncWrite,Available on crate feature
io only.Expand description
Asynchronously copies data bidirectionally between two pairs of reader and writer.
This function takes two Splittable objects, reader and writer, and
splits them into their respective read and write halves. It then
concurrently copies data from the read half of reader to the write half of
writer, and from the read half of writer to the write half of reader.
The function returns a tuple containing the results of both copy operations,
which indicate the total number of bytes copied in each direction or any
errors that occurred during the copying process.