File: simple.rs

package info (click to toggle)
rust-pbr 1.0.1-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye
  • size: 3,924 kB
  • sloc: makefile: 2
file content (18 lines) | stat: -rw-r--r-- 411 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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!");
}