summaryrefslogtreecommitdiff
path: root/vendor/indicatif/examples/morebars.rs
diff options
context:
space:
mode:
authorValentin Popov <valentin@popov.link>2024-01-08 00:21:28 +0300
committerValentin Popov <valentin@popov.link>2024-01-08 00:21:28 +0300
commit1b6a04ca5504955c571d1c97504fb45ea0befee4 (patch)
tree7579f518b23313e8a9748a88ab6173d5e030b227 /vendor/indicatif/examples/morebars.rs
parent5ecd8cf2cba827454317368b68571df0d13d7842 (diff)
downloadfparkan-1b6a04ca5504955c571d1c97504fb45ea0befee4.tar.xz
fparkan-1b6a04ca5504955c571d1c97504fb45ea0befee4.zip
Initial vendor packages
Signed-off-by: Valentin Popov <valentin@popov.link>
Diffstat (limited to 'vendor/indicatif/examples/morebars.rs')
-rw-r--r--vendor/indicatif/examples/morebars.rs28
1 files changed, 28 insertions, 0 deletions
diff --git a/vendor/indicatif/examples/morebars.rs b/vendor/indicatif/examples/morebars.rs
new file mode 100644
index 0000000..30b664f
--- /dev/null
+++ b/vendor/indicatif/examples/morebars.rs
@@ -0,0 +1,28 @@
+use std::sync::Arc;
+use std::thread;
+use std::time::Duration;
+
+use indicatif::{MultiProgress, ProgressBar, ProgressStyle};
+
+fn main() {
+ let m = Arc::new(MultiProgress::new());
+ let sty = ProgressStyle::with_template("{bar:40.green/yellow} {pos:>7}/{len:7}").unwrap();
+
+ let pb = m.add(ProgressBar::new(5));
+ pb.set_style(sty.clone());
+
+ // make sure we show up at all. otherwise no rendering
+ // event.
+ pb.tick();
+ for _ in 0..5 {
+ let pb2 = m.add(ProgressBar::new(128));
+ pb2.set_style(sty.clone());
+ for _ in 0..128 {
+ thread::sleep(Duration::from_millis(5));
+ pb2.inc(1);
+ }
+ pb2.finish();
+ pb.inc(1);
+ }
+ pb.finish_with_message("done");
+}