pub struct Progress { /* private fields */ }
Expand description
A generic progress bar that needs to be manually updated.
Example
let mut progress = Progress::new()
.with_bar_width(30)
.with_extra_infos("Hello, World!")
.with_refresh_delay(Duration::from_millis(100))
.with_output_stream(OutputStream::StdErr);
for i in 0..10_000 {
progress.update(i as f32 / 10_000.).unwrap();
progress = progress
.with_extra_infos(format!("Hello, World! ({}/10000)", i + 1));
sleep(Duration::from_nanos(110));
}
progress.finished().ok();
Implementations
Change the style of the bar disposition.
Change the width of the progress bar.
Change the width of the text the displayed informations should try to fit in. The terminal width will be detected by default.
Specify extra informations to display.
Change the output stream the progress bar is displayed in. By default standart output is used.
Change the text displayed in front of progress informations.
Example
use prog_rs::prelude::*;
use prog_rs::Progress;
let progress = Progress::new().with_prefix("Computing something ...");
for i in (0..1000) {
progress.update(i as f32 / 1000.)?;
do_something(i);
}
progress.finish()?;
Change the minimum delay between two display updates.
Change the character used to draw the body of the progress bar.
Change the character used to draw the head of the progress bar.
Change the character used to draw the background of the progress bar.
Update extra informations displayed next to the progress bar.
Check if the timer specified by with_refresh_delay
has decayed.
Redraw the progress bar if the timer has decayed.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Progress
impl UnwindSafe for Progress
Blanket Implementations
Mutably borrows from an owned value. Read more