#progress #bar #display #terminal #style #remaining #linux

progress_bar

A crate that allows you to display a progress bar (same style than the cargo progress bar)

10 releases (6 stable)

1.0.5 Jun 16, 2023
1.0.3 Oct 10, 2022
1.0.2 Apr 20, 2022
0.1.3 Jan 19, 2020
0.1.0 Nov 9, 2019

#169 in Command-line interface

Download history 13/week @ 2024-01-01 45/week @ 2024-01-08 46/week @ 2024-01-15 21/week @ 2024-01-22 20/week @ 2024-01-29 19/week @ 2024-02-05 32/week @ 2024-02-12 96/week @ 2024-02-19 195/week @ 2024-02-26 145/week @ 2024-03-04 135/week @ 2024-03-11 66/week @ 2024-03-18 44/week @ 2024-03-25 155/week @ 2024-04-01 57/week @ 2024-04-08 88/week @ 2024-04-15

356 downloads per month
Used in 4 crates

MIT license

17KB
293 lines

progress_bar

This crate allows you to display a pretty progress bar in the terminal.

Able to estimate and display the remaining time.

LINUX ONLY

Example

use progress_bar::*;

// if you have 81 pages to load
init_progress_bar(81);
set_progress_bar_action("Loading", Color::Blue, Style::Bold);

for i in 0..81 {
    // load page
    sleep(Duration::from_millis(500));

    // log the result
    if i == 14 {
        print_progress_bar_info("Failed", "to load https://zefzef.zef", Color::Red, Style::Normal);
    } else if i == 41 {
        print_progress_bar_info("Success", "loading https://example.com", Color::Green, Style::Bold);
    }

    // increase the progress by 1
    inc_progress_bar();
}

finalize_progress_bar();

image displaying the output of the code above

License: MIT


lib.rs:

This crate allows you to display a pretty progress bar in the terminal.

Able to estimate and display the remaining time.

LINUX ONLY

Example

use progress_bar::*;

// if you have 81 pages to load
init_progress_bar(81);
set_progress_bar_action("Loading", Color::Blue, Style::Bold);

for i in 0..81 {
    // load page
    sleep(Duration::from_millis(500));

    // log the result
    if i == 14 {
        print_progress_bar_info("Failed", "to load https://zefzef.zef", Color::Red, Style::Normal);
    } else if i == 41 {
        print_progress_bar_info("Success", "loading https://example.com", Color::Green, Style::Bold);
    }
    
    // increase the progress by 1
    inc_progress_bar();
}

finalize_progress_bar();

image displaying the output of the code above

Dependencies

~11KB