Expand description
§💤
The progress bar with sane defaults that doesn’t slow down your loops. Inspired by tqdm.
[dependencies]
zzz = "0.3"
§Features
- Seamless integration with iterators and streams
- If possible,
zzz
infers the target size fromsize_hint()
- If possible,
- Automagically determines and updates a good printing frequency
- Very low overhead: doesn’t slow down your loop, pretty much no matter how simple the loop body. On Skylake, the average overhead per iteration for a
!Sync
/add
based progress bar is 3 CPU cyclesSync
/add_sync
based progress bar is ~40 CPU cycles (depends on how many threads are updating the shared state)
§Cargo Features
streams
: Enables support for.progress()
on async streams (futures::streams::Stream
)
§Usage examples
Adding a progress bar to an iterator
use zzz::ProgressBarIterExt as _;
for _ in (0..1000).into_iter().progress() {
// ^^^^^^^^
}
If size_hint()
for the iterator defines an upper bound, it is automatically taken as the target. Otherwise, a progress indicator (“spinner”) is displayed.
Manually creating and advancing a progress bar
use zzz::ProgressBar;
let mut pb = ProgressBar::with_target(1234);
for _ in 0..1234 {
pb.add(1);
}
Manually creating a spinner (for unknown target progress indicator)
use zzz::ProgressBar;
let mut pb = ProgressBar::spinner();
for _ in 0..5678 {
pb.add(1);
}
Modules§
- prelude
- Mass-import for the main progress bar type as well as the convenience extension traits.
Structs§
- Config
- Configuration for a progress bar.
- Progress
Bar - Progress bar to be rendered on the terminal.
- Progress
BarIter - Iterator / stream wrapper that automatically updates a progress bar during iteration.
Enums§
- Render
Error - Errors that can ocurr while drawing the progress bar.
- Unit
- Determines the unit used for printing iteration speed.
Traits§
- Progress
BarIter Ext - Extension trait implemented for all iterators, adding methods for conveniently adding a progress bar to an existing iterator.
- Theme
- Trait defining how the progress bar is rendered.
Functions§
- global_
config - Gets the currently active global configuration.
- set_
global_ config - Set a new global default configuration.