Crate async_copy_progress[][src]

Expand description

githubcrates-iodocs-rs


Asynchronous copying with progress callbacks.

See copy for details.


Example

let mut reader: &[u8] = b"hello";
let mut writer: Vec<u8> = vec![];

let progress = AtomicU64::new(0);
let report_progress = |amt| progress.store(amt, Ordering::Relaxed);

async_copy_progress::copy(&mut reader, &mut writer, report_progress).await?;

assert_eq!(&b"hello"[..], &writer[..]);
assert_eq!(5, progress.load(Ordering::Relaxed));

Structs

Copy

Future for the copy function.

Functions

copy

Creates a future which copies all the bytes from one object to another while reporting the progress.