Crates.io | prog_rs |
lib.rs | prog_rs |
version | 0.2.0 |
source | src |
created_at | 2020-01-26 19:46:44.114119 |
updated_at | 2020-02-02 20:09:56.202205 |
description | Convenient progress bar |
homepage | |
repository | https://github.com/remi-dupre/prog-rs |
max_upload_size | |
id | 202234 |
size | 155,666 |
A Rust library to help easily build a progress bar.
First, add the following to your Cargo.toml
:
[dependencies]
prog_rs = "0.1"
Next, add this to your crate root:
extern crate prog_rs;
To add a progress bar while iterating, just add .progress()
behind your
iterator:
use prog_rs::prelude::*;
fn main() {
for _ in (0..1_000).progress() {
std::thread::sleep(std::time::Duration::from_millis(5));
}
}
Some parameters can be tweaked using with_
prefixed methods:
use prog_rs::prelude::*;
fn main() {
for _ in (0..1_000)
.progress()
.with_prefix("Processing...")
.with_output_stream(prog_rs::OutputStream::StdErr)
.with_bar_position(prog_rs::BarPosition::Right)
{
do_something();
}
}