pub trait ProgressIteratorExt: Iterator + Sized {
// Provided methods
fn progress_with(self, len: usize, name: &str) -> LogProgressIterator<Self> ⓘ { ... }
fn progress(self, name: &str) -> LogProgressIterator<Self> ⓘ
where Self: ExactSizeIterator { ... }
}Expand description
Extension trait for wrapping iterators with progress tracking.
This trait is implemented for all iterators and provides the .progress_with() method
which requires manually specifying the total length.
§Examples
use mtlog_progress::ProgressIteratorExt;
vec![1, 2, 3, 4, 5]
.into_iter()
.progress_with(5, "Processing items")
.for_each(|item| {
// Work with item
});Provided Methods§
Sourcefn progress_with(self, len: usize, name: &str) -> LogProgressIterator<Self> ⓘ
fn progress_with(self, len: usize, name: &str) -> LogProgressIterator<Self> ⓘ
Wrap this iterator with progress tracking.
§Arguments
len- The total number of items in the iteratorname- The name to display for this progress bar
§Examples
use mtlog_progress::ProgressIteratorExt;
std::iter::repeat(42)
.take(100)
.progress_with(100, "Repeated values")
.for_each(|_| { /* work */ });Sourcefn progress(self, name: &str) -> LogProgressIterator<Self> ⓘwhere
Self: ExactSizeIterator,
fn progress(self, name: &str) -> LogProgressIterator<Self> ⓘwhere
Self: ExactSizeIterator,
Wrap this ExactSizeIterator with automatic length detection.
§Examples
use mtlog_progress::ProgressIteratorExt;
(0..100)
.progress("Counting")
.for_each(|n| {
// Work with n
});Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.