Ben Chuanlong Du's Blog

It is never too late to learn.

Hands on the Rust Crate Indicatif

Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!

The indicatif crate does not work with Jupyter/Lab notebook yet.

In [14]:
:sccache 1
:dep indicatif = ">=0.16.2"
Out[14]:
sccache: true
In [10]:
use std::thread;
use std::time::Duration;
use indicatif::{MultiProgress, ProgressBar, ProgressStyle};
In [15]:
use std::thread;
use std::time::Duration;
use indicatif::ProgressBar;

{
    let pb = ProgressBar::new(1024);
    for _ in 0..1024 {
        pb.inc(1);
        thread::sleep(Duration::from_millis(5));
    }
    pb.finish_with_message("done");
}
Out[15]:
()
In [ ]:

Comments