10 unstable releases (3 breaking)

0.3.1 Jun 18, 2023
0.3.0 Jun 10, 2023
0.2.1 May 30, 2023
0.2.0 Jan 16, 2023
0.0.0 Oct 24, 2020

#1 in #tqdm

Download history 106/week @ 2024-04-21 25/week @ 2024-04-28 147/week @ 2024-05-05 144/week @ 2024-05-12 167/week @ 2024-05-19 28/week @ 2024-05-26 79/week @ 2024-06-02 28/week @ 2024-06-09 18/week @ 2024-06-16 23/week @ 2024-06-23 6/week @ 2024-06-30 14/week @ 2024-07-07 9/week @ 2024-07-14 26/week @ 2024-07-21 32/week @ 2024-07-28 8/week @ 2024-08-04

76 downloads per month
Used in cotton

MIT/Apache

30KB
519 lines

💤

Crates.io docs.rs MIT licensed Apache 2.0 licensed

The progress bar with sane defaults that doesn't slow down your loops. Inspired by tqdm.

Screenshot

[dependencies]
zzz = "0.3"

Features

  • Seamless integration with iterators and streams
    • If possible, zzz infers the target size from size_hint()
  • 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 cycles
    • Sync/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);
}

Dependencies

~185KB