Skip to content

Commit

Permalink
Add sleep in iterator example to see bars
Browse files Browse the repository at this point in the history
  • Loading branch information
bidoubiwa authored and djc committed Sep 20, 2021
1 parent 33a411b commit c9425b6
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions examples/iterator.rs
@@ -1,14 +1,19 @@
use std::thread;
use std::time::Duration;

use indicatif::{ProgressBar, ProgressIterator, ProgressStyle};

fn main() {
// Default styling, attempt to use Iterator::size_hint to count input size
for _ in (0..1000).progress() {
// ...
thread::sleep(Duration::from_millis(5));
}

// Provide explicit number of elements in iterator
for _ in (0..1000).progress_count(1000) {
// ...
thread::sleep(Duration::from_millis(5));
}

// Provide a custom bar style
Expand All @@ -18,5 +23,6 @@ fn main() {
));
for _ in (0..1000).progress_with(pb) {
// ...
thread::sleep(Duration::from_millis(5));
}
}

0 comments on commit c9425b6

Please sign in to comment.