Crates.io | rich_progress_bar |
lib.rs | rich_progress_bar |
version | 1.1.0 |
source | src |
created_at | 2024-06-14 18:43:16.223363 |
updated_at | 2024-06-15 05:11:53.441296 |
description | RichProgressBar is a Rust crate that provides a customizable progress bar for console applications. |
homepage | |
repository | |
max_upload_size | |
id | 1272273 |
size | 375,492 |
RichProgressBar is a Rust crate that provides a customizable progress bar for console applications.
Add this to your Cargo.toml
:
[dependencies]
rich_progress_bar = "1.0.0"
And this to your crate root:
extern crate rich_progress_bar;
Here's a simple example of how to use ProgressBar:
use rich_progress_bar::RichProgressBar;
use rich_progress_bar::Colors;
use rich_progress_bar::DisplayMode;
let mut progress = RichProgressBar::new();
progress
.set_color(Colors::Black)
.set_bar_length(80)
.set_display_mode(DisplayMode::Inline)
.set_total(100);
for _ in 0..100 {
progress.inc();
std::thread::sleep(std::time::Duration::from_millis(150));
}
Example with NewLine
display mode
fn main(){
let mut progress = RichProgressBar::new();
progress
.set_color(Colors::Yellow)
.set_bar_length(80)
.set_display_mode(DisplayMode::NewLine)
.set_progress_character('-')
.set_total(100);
for _ in 0..100 {
progress.inc();
std::thread::sleep(std::time::Duration::from_millis(150));
}
}