use std::thread;
use std::time::Duration;
use zfish::{ProgressBar, ProgressStyle};
fn main() {
println!("=== zfish Progress Bar Styles Demo ===\n");
println!("Example 1: Classic style [========== ]");
let mut pb = ProgressBar::new(100);
for i in 0..=100 {
thread::sleep(Duration::from_millis(20));
pb.set(i);
}
pb.finish("✓ Classic complete!");
println!("\nExample 2: Arrow style [=========> ]");
let mut pb = ProgressBar::new(100).with_style(ProgressStyle::Arrow);
for i in 0..=100 {
thread::sleep(Duration::from_millis(20));
pb.set(i);
}
pb.finish("✓ Arrow complete!");
println!("\nExample 3: Dots style [********** ]");
let mut pb = ProgressBar::new(100).with_style(ProgressStyle::Dots);
for i in 0..=100 {
thread::sleep(Duration::from_millis(20));
pb.set(i);
}
pb.finish("✓ Dots complete!");
println!("\nExample 4: Spinner style [/|/|/|/| ]");
let mut pb = ProgressBar::new(100).with_style(ProgressStyle::Spinner);
for i in 0..=100 {
thread::sleep(Duration::from_millis(20));
pb.set(i);
}
pb.finish("✓ Spinner complete!");
println!("\nExample 5: Incremental progress (Arrow style)");
let mut pb = ProgressBar::new(50).with_style(ProgressStyle::Arrow);
for _ in 0..50 {
thread::sleep(Duration::from_millis(30));
pb.inc(1);
}
pb.finish("✓ Incremental done!");
println!("\nExample 6: Custom width (60 chars, Spinner)");
let mut pb = ProgressBar::new(80)
.width(60)
.with_style(ProgressStyle::Spinner);
for i in 0..=80 {
thread::sleep(Duration::from_millis(15));
pb.set(i);
}
pb.finish("✓ Custom width complete!");
println!("\n=== All examples complete! ===");
}