Crates.io | loading_bar |
lib.rs | loading_bar |
version | 1.1.0 |
source | src |
created_at | 2022-05-30 18:33:34.311686 |
updated_at | 2022-06-19 15:09:46.012782 |
description | Simple CLI loading bar crate |
homepage | https://github.com/mendelsshop/loading_bar |
repository | https://github.com/mendelsshop/loading_bar |
max_upload_size | |
id | 597104 |
size | 100,114 |
This my "Awesome" loading bar library.
The loading bar is a simple progress bar that can be used to show the progress of a long running process.
And different ways to advance the loading bar.
docs.rs Github Pages
LoadingBar,
TextLoadingBar,
SimpleLoadingBar
Put the following in your Cargo.toml file under [dependencies]
:
[dependencies]
loading_bar = "1.1.0"
Or the following if you want to test the latest features:
[dependencies]
"loading_bar" = { git = 'https://github.com/mendelsshop/loading_bar' }
use loading_bar::loading_bar::LoadingBar;
use loading_bar::{loading_bar::LoadingBar, Color}; // if you want to use the color feature
bar = LoadingBar::new(100, None, (0, 0)); // this creates a new loading bar with 100 steps and the default color at position 0,0
bar = LoadingBar::new(100, Some(Color::Green), (0, 0)); // this creates a new loading bar with 100 steps and the green color
loading_bar
crate.bar.print(); // this shows the loading bar
bar.advance(); // this increments the loading bar by 1 step
// takes no paramters
bar.advance_by(10); // this increments the loading bar by 10 steps
// takes a paramter of u16
bar.advance_by_percent(100); // this increments the loading bar by 100%
// takes a paramter of f32
// printsing and updating the loading bar
bar.advance_print(); // this increments the loading bar by 1 step and prints the current progress (each method has a print option)
bar.change_color(Some(Color::Red)); // this changes the color of the loading bar to red
// the change_color does not immediately change the color of the loading bar, it only changes the color when the next step is incremented when you print the bar next
bar.change_color(None); // changes the color to white (the default color)
LoadingBar::auto_run(10, 50, 10, Some(Color::Red), (0, 0)); // this creates a new loading bar lasts 10 seconds, with a length of 50, and starts at 10 bars with the color red.
LoadingBar::auto_run(10, 50, 10, None, (0, 0)); // as above but with the default color
let mut bar = LoadingBar::new(10, Some(Color::Red), (0, 0)); // this creates a new loading bar with 10 steps and the red color
bar.auto_run_from(bar, 10); // this takes ownership of the bar and increments automatically to the end in a duration of 10 seconds
Not documented yet.
Not documented yet.
crossterm
crate, so when using this crate you should understand how to use the aforementioned crate (and possibly import and use it for resseting the lines).Mendel's Shop
- (Me) for creating it.
Ryan
- For all the bugs any typos they caught and suggestions they had.