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

Create a new progress bar with default display settings.

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.

Redraw the progress bar for the last time.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.