pub struct ProgressBuilder { /* private fields */ }Expand description
A builder to create Progress with custom configuration.
See custom configuration for an example.
Implementations§
Source§impl ProgressBuilder
impl ProgressBuilder
Sourcepub fn build(self) -> Result<Progress, Error>
pub fn build(self) -> Result<Progress, Error>
Creates Progress using configuration of this ProgressBuilder.
See custom configuration for an example.
Sourcepub fn new(items: Vec<Item>) -> Self
pub fn new(items: Vec<Item>) -> Self
Creates ProgressBuilder to configure Progress.
If items is empty then default items are used instead.
progress_builder! macro should be used instead of this,
which is same as ProgressBuilder::new(items!(ITEMS)).
Sourcepub fn pre_inc(self) -> Self
pub fn pre_inc(self) -> Self
Sets increment mode to PreInc.
Increment mode can be PostInc (default) or PreInc.
PostIncmeans that progress position is incremented after the associated work.- For example incrementing position from 2 to 3 means that work of step 3 has been completed and work of step 4 is about to begin.
PreIncmeans that progress position is incremented before the associated work.- For example incrementing position from 2 to 3 means that work of step 2 has been completed and work of step 3 is about to begin.
§Examples
Here first step has been completed and second is about to begin so completion percentage is 33%.
use ml_progress::progress_builder;
let progress = progress_builder!("[" percent "] " pos "/" total)
.total(Some(3))
.pre_inc()
.build()?;
progress.inc(1);
progress.inc(1);
progress.finish_at_current_pos();[ 33%] 2/3Sourcepub fn thousands_separator(self, separator: &str) -> Self
pub fn thousands_separator(self, separator: &str) -> Self
Sets thousands separator, default is space.
See custom configuration for an example.
Auto Trait Implementations§
impl Freeze for ProgressBuilder
impl !RefUnwindSafe for ProgressBuilder
impl Send for ProgressBuilder
impl Sync for ProgressBuilder
impl Unpin for ProgressBuilder
impl !UnwindSafe for ProgressBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more