pub struct Progress { /* private fields */ }
Expand description
A progress bar “coordinator” to share between threads.
Implementations
sourceimpl Progress
impl Progress
sourcepub fn with_capacity(capacity: usize) -> Progress
pub fn with_capacity(capacity: usize) -> Progress
Like Progress::new
but accepts a size hint to avoid reallocation as bar count grows.
sourcepub fn bar<S: Into<String>>(&mut self, total: usize, label: S) -> Bar
pub fn bar<S: Into<String>>(&mut self, total: usize, label: S) -> Bar
Create a new progress bar with default styling and receive an owned handle to it.
Panics
Passing 0
to this function will cause a panic the first time a draw is
attempted.
sourcepub fn set(&mut self, bar: &Bar, value: usize)
pub fn set(&mut self, bar: &Bar, value: usize)
Set a particular Bar
’s progress value, but don’t draw it.
sourcepub fn draw(&mut self, bar: &Bar)
pub fn draw(&mut self, bar: &Bar)
Force the drawing of a particular Bar
.
Note 1: Drawing will only occur if there is something meaningful to show. Namely, if the progress has advanced at least 1% since the last draw.
Note 2: If your program is not being run in a terminal, an initial empty bar will be printed but never refreshed.
sourcepub fn set_and_draw(&mut self, bar: &Bar, value: usize)
pub fn set_and_draw(&mut self, bar: &Bar, value: usize)
Set a Bar
’s value and immediately try to draw it.
sourcepub fn inc(&mut self, bar: &Bar, value: usize)
pub fn inc(&mut self, bar: &Bar, value: usize)
Increment a given Bar
’s progress, but don’t draw it.
sourcepub fn inc_and_draw(&mut self, bar: &Bar, value: usize)
pub fn inc_and_draw(&mut self, bar: &Bar, value: usize)
Increment a given Bar
’s progress and immediately try to draw it.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Progress
impl Send for Progress
impl Sync for Progress
impl Unpin for Progress
impl UnwindSafe for Progress
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more