| 1 |
use std::thread; |
| 2 |
use std::time::Duration; |
| 3 |
|
| 4 |
use indicatif::{ProgressBar, ProgressStyle}; |
| 5 |
|
| 6 |
fn main() { |
| 7 |
let pb = ProgressBar::new_spinner(); |
| 8 |
pb.enable_steady_tick(Duration::from_millis(120)); |
| 9 |
pb.set_style( |
| 10 |
ProgressStyle::with_template("{spinner:.blue} {msg}") |
| 11 |
.unwrap() |
| 12 |
// For more spinners check out the cli-spinners project: |
| 13 |
// https://github.com/sindresorhus/cli-spinners/blob/master/spinners.json |
| 14 |
.tick_strings(&[ |
| 15 |
"▹▹▹▹▹", |
| 16 |
"▸▹▹▹▹", |
| 17 |
"▹▸▹▹▹", |
| 18 |
"▹▹▸▹▹", |
| 19 |
"▹▹▹▸▹", |
| 20 |
"▹▹▹▹▸", |
| 21 |
"▪▪▪▪▪", |
| 22 |
]), |
| 23 |
); |
| 24 |
pb.set_message("Calculating..."); |
| 25 |
thread::sleep(Duration::from_secs(5)); |
| 26 |
pb.finish_with_message("Done"); |
| 27 |
} |