loaders 0.0.0

A fully-featured, customisable progress bar and loading indicator library for Rust CLI and terminal applications
Documentation
use loaders::spinner::frames::{METER, PROGRESS_BLOCKS, PULSE};
use loaders::{ProgressStyle, Spinner};
use std::thread;
use std::time::Duration;

fn run_loader(
    name: &'static str,
    frames: &'static [&'static str],
) -> Result<(), Box<dyn std::error::Error>> {
    let spinner = Spinner::new_with_interval(frames, Duration::from_millis(70));
    let style = ProgressStyle::default_spinner()
        .tick_strings(frames)
        .with_key("loader_name", move |_| name.to_string())
        .template("{loader_name} {spinner} {msg}")?;
    spinner.set_style(style);
    spinner.start_with_message("warming up");
    thread::sleep(Duration::from_millis(300));
    spinner.set_message("loading");
    thread::sleep(Duration::from_millis(300));
    spinner.success(format!("{name} complete"));
    Ok(())
}

fn main() -> Result<(), Box<dyn std::error::Error>> {
    run_loader("meter", &METER)?;
    run_loader("blocks", &PROGRESS_BLOCKS)?;
    run_loader("pulse", &PULSE)?;
    Ok(())
}