pub struct ProgressBarBuilder { /* private fields */ }print only.Expand description
Builder for a progress bar
Implementations§
Source§impl ProgressBarBuilder
impl ProgressBarBuilder
Sourcepub fn new(message: String) -> Self
pub fn new(message: String) -> Self
Start building a progress bar. Note cu::progress is the canonical shorthand
Sourcepub fn total(self, total: usize) -> Self
pub fn total(self, total: usize) -> Self
Set the total steps. 0 means total is unknown, which can be set
at a later point.
By default, the progress bar is “unbounded”, meaning there is no individual steps
cu::progress("doing something").total(10);Sourcepub fn total_bytes(self, total: u64) -> Self
pub fn total_bytes(self, total: u64) -> Self
Set the total bytes and set the progress to be displayed using byte units (SI).
0 means total is unknown, which can be set at a later point.
cu::progress("doing something").total_bytes(1000000);Sourcepub fn keep(self, keep: bool) -> Self
pub fn keep(self, keep: bool) -> Self
Set if the progress bar should be kept in the output after it’s done.
Default is true for root progress bars and false
for child progress bars
cu::progress("doing something").keep(false);Sourcepub fn eta(self, show: bool) -> Self
pub fn eta(self, show: bool) -> Self
Set if ETA (estimated time) should be displayed.
Only effective if total is not zero (i.e. not unbounded).
Default is true
cu::progress("doing something").total(10).eta(false);Sourcepub fn percentage(self, show: bool) -> Self
pub fn percentage(self, show: bool) -> Self
Set if percentage should be displayed.
Only effective if total is not zero (i.e. not unbounded).
Default is true
cu::progress("doing something").total(10).percentage(false);Sourcepub fn when_done(self, message: impl Into<String>) -> Self
pub fn when_done(self, message: impl Into<String>) -> Self
Set a message to be displayed when the progress is done.
Requires keep(true) - which is the default, but
when_done will not automatically turn it on for you.
Default is the message of the progress bar followed by done.
cu::progress("doing something").when_done("something is done!");Sourcepub fn when_interrupt(self, message: impl Into<String>) -> Self
pub fn when_interrupt(self, message: impl Into<String>) -> Self
Set a message to be displayed when the progress is interrupted.
Default is the message of the progress bar followed by interrupted.
cu::progress("doing something").when_interrupt("something is interrupted!");Sourcepub fn max_display_children(self, num: usize) -> Self
pub fn max_display_children(self, num: usize) -> Self
Set the max number of children to display at a time. Default is unbounded.
cu::progress("doing something").max_display_children(30);Sourcepub fn parent(self, parent: Option<Arc<ProgressBar>>) -> Self
pub fn parent(self, parent: Option<Arc<ProgressBar>>) -> Self
Set the parent progress bar.
If the parent is known to be Some, use parent.child(...) instead
Sourcepub fn spawn(self) -> Arc<ProgressBar> ⓘ
pub fn spawn(self) -> Arc<ProgressBar> ⓘ
Build and start displaying the bar in the console
Trait Implementations§
Source§impl Clone for ProgressBarBuilder
impl Clone for ProgressBarBuilder
Source§fn clone(&self) -> ProgressBarBuilder
fn clone(&self) -> ProgressBarBuilder
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more