11 releases

0.4.4 Jan 30, 2023
0.4.3 Dec 27, 2022
0.4.2 Sep 16, 2022
0.4.0 May 17, 2022
0.1.1 Feb 5, 2022

#172 in Command-line interface

Download history 92/week @ 2023-01-28 153/week @ 2023-02-04 72/week @ 2023-02-11 564/week @ 2023-02-18 634/week @ 2023-02-25 608/week @ 2023-03-04 607/week @ 2023-03-11 1036/week @ 2023-03-18 1086/week @ 2023-03-25 594/week @ 2023-04-01 384/week @ 2023-04-08 807/week @ 2023-04-15 886/week @ 2023-04-22 741/week @ 2023-04-29 936/week @ 2023-05-06 490/week @ 2023-05-13

3,177 downloads per month
Used in 2 crates

MIT/Apache

585KB
294 lines

tqdm

Rust implementation of Python command line progress bar tool tqdm.

From original documentation:

tqdm derives from the Arabic word taqaddum (تقدّم) which can mean "progress," and is an abbreviation for "I love you so much" in Spanish (te quiero demasiado).

Instantly make your loops show a smart progress meter - just wrap any iterable with tqdm(iterable), and you're done!

demo

This crate provides a wrapper Iterator. It controls multiple progress bars when next is called.

Most traits are bypassed with auto-dereference, so original methods can be called with no overhead.

Usage

Just wrap anything that implements the Iterator trait with tqdm

use tqdm::tqdm;
for i in tqdm(0..10000) {
  ...
 76%|███████████████▉     | 7618/10000 [00:09<00:03, 782.14it/s]

Expose trait to allow method chaining

use tqdm::Iter;
for i in (0..).take(10000).tqdm().style(tqdm::Style::Balloon) {
  ...
 47%|**********.          | 4792/10000 [00:06<00:06, 783.39it/s]

Multi-threading is also supported!

use tqdm::tqdm;
use std::thread;
for t in (0..3) {
  thread::spawn(move || {
    for i in tqdm(0..).style(...) {
      ...
 38%|##########0               | 77/200 [00:00<00:01, 83.24it/s]
 77%|████████████████████      | 77/100 [00:00<00:00, 83.24it/s]
 19%|*****.                    | 77/400 [00:00<00:03, 83.24it/s]

For more usage, please refer to doc

Dependencies

~0.8–5.5MB
~87K SLoC