Crates.io | zzz |
lib.rs | zzz |
version | 0.3.1 |
source | src |
created_at | 2020-10-24 15:45:47.971106 |
updated_at | 2023-06-18 23:33:32.83452 |
description | Fast progress bar with sane defaults |
homepage | |
repository | https://github.com/athre0z/zzz |
max_upload_size | |
id | 305048 |
size | 49,787 |
The progress bar with sane defaults that doesn't slow down your loops. Inspired by tqdm.
[dependencies]
zzz = "0.3"
zzz
infers the target size from size_hint()
!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)streams
: Enables support for .progress()
on async streams (futures::streams::Stream
)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);
}