#cli #progress #progressbar #pb


A simple implementation of progress bar for rust

6 releases

0.1.5 Oct 17, 2022
0.1.4 Oct 13, 2022

#335 in Command-line interface

37 downloads per month

MIT license

508 lines

Rust Crates.io Documentation


A simple progress bar for Rust πŸ¦€ projects. I created that because there was a long processes in some project and I didn't know what was the progression.


Add from command line.

cargo add rpb@0.1.5

Or add this to your Cargo.toml file.

rpb = "0.1.5"

# Or add from github main branch.
rpb = { git = "https://github.com/disco07/rpb.git", branch = "main" }


Basic usage

fn main() {
    use rpb::bar::Bar;
    use std::thread::sleep;
    use std::time;
    let mut bar = Bar::new(200);

    for _i in 0..200 {

Basic bar examples/custom.rs Custom bar

I/O operations

The rpb implements an io writer and io reader so it can automatically detect the number of bytes written to a stream.

use rpb::bar::Bar;
use std::fs::File;
use std::io;

fn main() -> io::Result<()> {
    let source = File::open("data.sql")?;
    let mut target = File::create("src.sql")?;
    let bar = Bar::default_bytes(source.metadata()?.len() as i64, "downloading");
    io::copy(&mut bar.reader(source), &mut target).unwrap();

Custom bar

Contributing 🀝

Contributions, issues, and feature requests are welcome!

Feel free to check the issues page.

πŸ“ License

License: MIT