1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
use std::{thread, time::Duration};
fn main() {
for _ in progression::bar(0..1_000) {
thread::sleep(Duration::from_millis(1));
}
for _ in progression::bar_with_config(0..1_000, progression::Config::cargo()) {
thread::sleep(Duration::from_millis(1));
}
for _ in progression::bar_with_config(0..1_000, progression::Config::unicode()) {
thread::sleep(Duration::from_millis(1));
}
for _ in progression::bar_with_config(0..1_000, progression::Config { style: progression::Style::Mono('·'), ..Default::default() }) {
thread::sleep(Duration::from_millis(1));
}
let items = vec![1, 2, 3, 4, 5];
let bar = progression::Bar::new(items.len() as u64, progression::Config { prefix: "(items) ", ..progression::Config::cargo() });
for _ in items {
thread::sleep(Duration::from_millis(100));
bar.inc(1);
}
}