async-copy-progress

Crates.ioasync-copy-progress
lib.rsasync-copy-progress
version1.0.1
sourcesrc
created_at2021-05-26 16:31:37.253098
updated_at2021-05-26 16:37:03.97602
descriptionAsynchronous copying with progress callbacks.
homepage
repositoryhttps://github.com/mkroening/async-copy-progress
max_upload_size
id402342
size25,253
Martin Kröning (mkroening)

documentation

README

async-copy-progress

github crates.io docs.rs build status

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

Licensed under either of Apache License, Version 2.0 or MIT license at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
Commit count: 5

cargo fmt