Expand description
Progress bars and spinners for CLI applications.
- Crate
::indicatif. - docs.rs
- crates.io
- GitHub
indicatif provides progress bars, spinners, and other progress indicators
for command-line applications.
It handles terminal width, colors, and smooth updates.
The main types are ProgressBar for single progress indicators
and MultiProgress for displaying multiple progress bars simultaneously.
Use ProgressStyle to customize the appearance.
§Examples
Simple progress bar:
use indicatif::ProgressBar;
let pb = ProgressBar::new(100);
for i in 0..100 {
pb.inc(1);
// Do work...
}
pb.finish_with_message("done");Styled progress bar:
use indicatif::{ProgressBar, ProgressStyle};
let pb = ProgressBar::new(1000);
pb.set_style(ProgressStyle::with_template(
"{spinner:.green} [{elapsed_precise}] [{bar:40.cyan/blue}] {pos}/{len} ({eta})"
).unwrap());
for _ in 0..1000 {
pb.inc(1);
}
pb.finish();Spinner for indeterminate progress:
use indicatif::ProgressBar;
use std::time::Duration;
let spinner = ProgressBar::new_spinner();
spinner.set_message("Loading...");
spinner.enable_steady_tick(Duration::from_millis(100));
// Do work...
spinner.finish_with_message("Done!");Modules§
Structs§
- Binary
Bytes - Formats bytes for human readability using ISO/IEC prefixes
- Decimal
Bytes - Formats bytes for human readability using SI prefixes
- Formatted
Duration - Wraps an std duration for human basic formatting.
- Human
Bytes - Formats bytes for human readability
- Human
Count - Formats counts for human readability using commas
- Human
Duration - Wraps an std duration for human readable formatting.
- Human
Float Count - Formats counts for human readability using commas for floats
- Multi
Progress - Manages multiple progress bars from different threads
- Progress
Bar - A progress bar or spinner
- Progress
BarIter - Wraps an iterator to display its progress.
- Progress
Draw Target - Target for draw operations
- Progress
State - The state of a progress bar at a moment in time.
- Progress
Style - Weak
Progress Bar - A weak reference to a
ProgressBar.
Enums§
- Multi
Progress Alignment - Vertical alignment of a multi progress.
- Progress
Finish - Behavior of a progress bar when it is finished
Traits§
- Progress
Iterator - Wraps an iterator to display its progress.
- Term
Like - A trait for minimal terminal-like behavior.