Expand description


A Rust library to help easily build a progress bar.

Basic usage

To add a progress bar while iterating, just add .progress() behind your iterator:

use prog_rs::prelude::*;

for _ in (0..1_000).progress() {

Some parameters can be tweaked using with_ prefixed methods:

use prog_rs::prelude::*;

for _ in (0..1_000)

Advanced usage

It is possible to control how the progress bar behaves by controlling it outside of the iterators wrapper:

let mut progress = Progress::new()
    .with_extra_infos("Hello, World!")

for i in 0..10_000 {
    progress.update(i as f32 / 10_000.).unwrap();
    progress = progress
        .with_extra_infos(format!("Hello, World! ({}/10000)", i + 1));


This same behaviour is also implemented for files:

use prog_rs::prelude::*;

let f = File::open("../../data/addresses/bano.csv")
    .with_prefix(" Read file ...")
let f = BufReader::new(f);
println!("This file has {} lines", f.lines().count());


The progress bar redraw rate is restricted to avoid making a huge number of I/O and avoid loosing too much CPU time.

On most uses, it won’t affect performances, but avoid using it if you use an iterator very intensively (more than about 100M iterations/s).

Implementation details

How is the remaining number of iterations computed?

The remaining number of iterations is computed by using size_hint by default, if you want to specify a more accurate value, you can use with_iter_size.


pub use file_progress::*;
pub use iter_progress::*;
pub use progress::*;
pub use step_progress::*;


Defines a wrapper around files to display a progress bar.

Defines a wrapper around iterators to display a progress bar.

All traits specified in the crate.

Defines a basic progress bar that needs to be manually updated.

Defines wrapper for a progress bar which can only step forward.