ProgressBarIter has a with_style method that lets you set the progress bar's style. But if you want to change the finish behavior, i.e. whether the progress bar remains on screen or is erased when it completes, you have to create a new ProgressBar and pass it to progress_with.
To keep the progress bar on screen when it finishes, I can do the following:
let v = vec![0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
v.iter()
.progress_with(ProgressBar::new(v.len() as u64).with_finish(ProgressFinish::AndLeave));
However, it's a bit verbose and needs to explicitly pass the length of the vector to ProgressBar::new.
I think it would be convenient to have the more concise form:
ProgressBarIter
has awith_style
method that lets you set the progress bar's style. But if you want to change the finish behavior, i.e. whether the progress bar remains on screen or is erased when it completes, you have to create a newProgressBar
and pass it toprogress_with
.To keep the progress bar on screen when it finishes, I can do the following:
However, it's a bit verbose and needs to explicitly pass the length of the vector to
ProgressBar::new
.I think it would be convenient to have the more concise form:
If this is acceptable from an API perspective, I can write the PR.