2 unstable releases
0.2.0 | Jun 13, 2021 |
---|---|
0.1.0 | Apr 29, 2020 |
#1226 in Asynchronous
94 downloads per month
Used in 2 crates
14KB
297 lines
Async Read Progress
Context: Rust, async/await, async readers.
Extension traits for inspecting AsyncRead
progress.
Supports futures 0.3 and tokio 0.2.
License
Licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
lib.rs
:
Report the progress of an async read operation
As promised on Twitter.
Examples
use futures::{
io::AsyncReadExt,
stream::{self, TryStreamExt},
};
use async_read_progress::*;
let src = vec![1u8, 2, 3, 4, 5];
let total_size = src.len();
let reader = stream::iter(vec![Ok(src)]).into_async_read();
let mut reader = reader.report_progress(
/* only call every */ std::time::Duration::from_millis(20),
|bytes_read| eprintln!("read {}/{}", bytes_read, total_size),
);
#
Dependencies
~0–5.5MB
~20K SLoC