Expand description
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),
);
Structs§
- LogStream
Progress - Reader for the
report_progress
method.
Traits§
- Async
Read Progress Ext - An extension trait which adds the
report_progress
method toAsyncRead
types. - Tokio
Async Read Progress Ext - An extension trait which adds the
report_progress
method toAsyncRead
types.