Crate async_read_progress[][src]

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

LogStreamProgress

Reader for the report_progress method.

Traits

AsyncReadProgressExt

An extension trait which adds the report_progress method to AsyncRead types.

TokioAsyncReadProgressExt

An extension trait which adds the report_progress method to AsyncRead types.