Skip to content

Commit

Permalink
examples: add npm_bar example
Browse files Browse the repository at this point in the history
  • Loading branch information
a8m committed Oct 27, 2016
1 parent 8e0c683 commit 1affc59
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions examples/npm_bar.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
extern crate pbr;
use pbr::ProgressBar;
use std::thread;
use std::time::Duration;

fn main() {
let count = 30;
let mut pb = ProgressBar::new(count * 10);
pb.tick_format("\\|/-");
pb.format("|#--|");
pb.show_tick = true;
pb.show_speed = false;
pb.show_percent = false;
pb.show_counter = false;
pb.show_time_left = false;
pb.inc();
for _ in 0..count {
for _ in 0..10 {
pb.message("normalize -> thing ");
thread::sleep(Duration::from_millis(80));
pb.tick();
}
for _ in 0..10 {
pb.message("fuzz -> tree ");
thread::sleep(Duration::from_millis(80));
pb.inc();
}
}
pb.finish_println("done!");
}

0 comments on commit 1affc59

Please sign in to comment.