Skip to main content

dev_scripts/
ui.rs

1use indicatif::{ProgressBar, ProgressStyle};
2
3/// Get a styled indicatif progress bar for reuse across the project.
4// TODO(cleanup): Return an error instead of panic
5#[expect(clippy::expect_used)]
6pub fn get_progress_bar(items: u64) -> ProgressBar {
7    let bar = ProgressBar::new(items);
8    bar.set_style(
9        ProgressStyle::with_template(
10            "{spinner:.green} [{elapsed_precise}] [{bar:40.cyan/blue}] ({pos}/{len}, ETA {eta})",
11        )
12        .expect("This progress syntax is valid"),
13    );
14
15    bar
16}