Skip to content

Commit bd320a1

Browse files
authored
Add builder-like with_finish method to ProgressBarIter. (#548)
Co-authored-by: Matthew Chan <>
1 parent a81fd6c commit bd320a1

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/iter.rs

+9
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ use std::time::Duration;
1212
use tokio::io::{ReadBuf, SeekFrom};
1313

1414
use crate::progress_bar::ProgressBar;
15+
use crate::state::ProgressFinish;
1516
use crate::style::ProgressStyle;
1617

1718
/// Wraps an iterator to display its progress.
@@ -103,6 +104,14 @@ impl<T> ProgressBarIter<T> {
103104
self.progress = self.progress.with_elapsed(elapsed);
104105
self
105106
}
107+
108+
/// Builder-like function for setting underlying progress bar's finish behavior.
109+
///
110+
/// See [ProgressBar::with_finish].
111+
pub fn with_finish(mut self, finish: ProgressFinish) -> Self {
112+
self.progress = self.progress.with_finish(finish);
113+
self
114+
}
106115
}
107116

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

0 commit comments

Comments
 (0)