Crates.io | async-copy-progress |
lib.rs | async-copy-progress |
version | 1.0.1 |
source | src |
created_at | 2021-05-26 16:31:37.253098 |
updated_at | 2021-05-26 16:37:03.97602 |
description | Asynchronous copying with progress callbacks. |
homepage | |
repository | https://github.com/mkroening/async-copy-progress |
max_upload_size | |
id | 402342 |
size | 25,253 |
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"
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));