Open
Description
Reproducer (using indicatif 0.17.8, default feature set):
use indicatif::{ProgressBar, ProgressStyle};
fn main() {
let pb_style = ProgressStyle::default_bar()
.template("{bar:16} | {pos:>6}/{len:6} | {per_sec:>8}")
.unwrap();
let pb = ProgressBar::new(100000).with_style(pb_style);
for _ in 0..1000 {
std::thread::sleep(std::time::Duration::from_secs_f64(0.01));
pb.inc(100);
}
pb.finish();
}
The progress bar that's left after the program runs:
████████████████ | 100000/100000 | 9,631.6687/s
Despite per_sec
specifying a width of 8 characters, the final per_sec
display is 12 characters wide. I would have expected the formatter to trim the number of digits after the decimal point to reduce the width instead.
Compressed asciinema recording of the above program running on my machine:
Metadata
Metadata
Assignees
Labels
No labels