Skip to content

Commit

Permalink
Add builder-like with_finish method to ProgressBarIter. (#548)
Browse files Browse the repository at this point in the history
Co-authored-by: Matthew Chan <>
  • Loading branch information
matthewhchan committed Jun 3, 2023
1 parent a81fd6c commit bd320a1
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/iter.rs
Expand Up @@ -12,6 +12,7 @@ use std::time::Duration;
use tokio::io::{ReadBuf, SeekFrom};

use crate::progress_bar::ProgressBar;
use crate::state::ProgressFinish;
use crate::style::ProgressStyle;

/// Wraps an iterator to display its progress.
Expand Down Expand Up @@ -103,6 +104,14 @@ impl<T> ProgressBarIter<T> {
self.progress = self.progress.with_elapsed(elapsed);
self
}

/// Builder-like function for setting underlying progress bar's finish behavior.
///
/// See [ProgressBar::with_finish].
pub fn with_finish(mut self, finish: ProgressFinish) -> Self {
self.progress = self.progress.with_finish(finish);
self
}
}

impl<S, T: Iterator<Item = S>> Iterator for ProgressBarIter<T> {
Expand Down

0 comments on commit bd320a1

Please sign in to comment.