Skip to content

Commit

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

fn main() {
let count = 500;
let mut pb = ProgressBar::new(count);
pb.format("╢▌▌░╟");
for _ in 0..count {
pb.inc();
let n = rand::thread_rng().gen_range(0, 100);
thread::sleep(Duration::from_millis(n));
}
pb.finish_println("done!");
}

0 comments on commit 8e0c683

Please sign in to comment.