async-copy-progress 1.0.1

Asynchronous copying with progress callbacks.
Documentation

async-copy-progress

Asynchronous copies with progress updates.

This library provides an asynchronous copy function which calls a function with the current progress after each step.

[dependencies]
async-copy-progress = "1.0"

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));

License