#progress-bar #string

progress_string

Generate a progress bar string

4 releases

0.2.1 Oct 7, 2022
0.2.0 Mar 28, 2021
0.1.1 Nov 8, 2017
0.1.0 Nov 6, 2017

#42 in #progress-bar

Download history 38/week @ 2024-06-15 30/week @ 2024-06-22 66/week @ 2024-06-29 21/week @ 2024-07-06 72/week @ 2024-07-13 10/week @ 2024-07-20 90/week @ 2024-07-27 39/week @ 2024-08-03 15/week @ 2024-08-10 26/week @ 2024-08-17 19/week @ 2024-08-24 23/week @ 2024-08-31 40/week @ 2024-09-07 31/week @ 2024-09-14 35/week @ 2024-09-21 282/week @ 2024-09-28

388 downloads per month
Used in 2 crates

MIT license

18KB
249 lines

progress_string

This library is primarily concerned with generating strings that can be used by your favorite terminal stream manipulation system to display a progress bar like this:

[██████████████████                                ] 35.70%

Documentation

Examples

Run an example with cargo run --example <example-name>. E.g. cargo run --example termion.

License

MIT


lib.rs:

This library is primarily concerned with generating strings that can be used by your favorite terminal stream manipulation system to display a progress bar.

Example

use std::thread::sleep;
use std::time::Duration;

const TOTAL: usize = 1000;
fn main() {
    let mut bar = progress_string::BarBuilder::new()
        .total(TOTAL)
        .include_percent()
        .build();

    println!("starting the progress");
    for i in 0..TOTAL {
        bar.replace(i);
        print!(
            "{}{}",
            termion::cursor::Left(bar.get_last_width() as u16),
            bar.to_string()
        );
        sleep(Duration::from_millis(10));
    }
    println!("\ndone with progress");
}

No runtime deps