pub struct GradientProgressBar { /* private fields */ }Expand description
A self-contained wrapper around indicatif::ProgressBar.
The underlying ProgressBar is Clone / Send / Sync, so an
GradientProgressBar is too : share it across worker threads, pass it by
reference, or keep several live at once.
Implementations§
Source§impl GradientProgressBar
impl GradientProgressBar
Sourcepub fn new(
len: u64,
msg: impl Into<String>,
style: BarStyle,
gradient: Option<Gradient>,
unit: Option<String>,
) -> Self
pub fn new( len: u64, msg: impl Into<String>, style: BarStyle, gradient: Option<Gradient>, unit: Option<String>, ) -> Self
Create a bar with a known total, an explicit layout, an explicit
style (gradient or not) and a unit (chunks, seconds, meters…)
Sourcepub fn new_with_bar_width(
len: u64,
msg: impl Into<String>,
style: BarStyle,
gradient: Option<Gradient>,
bar_width: usize,
unit: Option<String>,
) -> Self
pub fn new_with_bar_width( len: u64, msg: impl Into<String>, style: BarStyle, gradient: Option<Gradient>, bar_width: usize, unit: Option<String>, ) -> Self
Create a bar with a known total, an explicit layout, an explicit
style (gradient or not), a unit (chunks, seconds, meters…) and a bar width.
Sourcepub fn with_total_bytes(total: u64, msg: impl Into<String>) -> Self
pub fn with_total_bytes(total: u64, msg: impl Into<String>) -> Self
Create a byte-based bar (the usual entry point) with the default
gradient (DEFAULT_GRADIENT).
Sourcepub fn with_total_steps(total: u64, msg: impl Into<String>) -> Self
pub fn with_total_steps(total: u64, msg: impl Into<String>) -> Self
Create a step/chunk based bar with the default gradient.
Sourcepub fn new_spinner(msg: impl Into<String>) -> Self
pub fn new_spinner(msg: impl Into<String>) -> Self
Create an indeterminate (unknown total) bar animated with a spinner.
Sourcepub fn with_gradient(
total: u64,
msg: impl Into<String>,
gradient: Gradient,
) -> Self
pub fn with_gradient( total: u64, msg: impl Into<String>, gradient: Gradient, ) -> Self
Create a byte-based bar with a specific Gradient.
Sourcepub fn with_wide_bar(total: u64, msg: impl Into<String>) -> Self
pub fn with_wide_bar(total: u64, msg: impl Into<String>) -> Self
Create a byte-based bar keeping the classic two-tone wide_bar (no
true-color gradient).
Sourcepub fn set_length(&self, len: u64)
pub fn set_length(&self, len: u64)
Set a new total length.
Sourcepub fn inc_length(&self, delta: u64)
pub fn inc_length(&self, delta: u64)
Grow the total length by delta.
Sourcepub fn set_message(&self, msg: impl Into<String>)
pub fn set_message(&self, msg: impl Into<String>)
Change the message shown next to the bar.
Sourcepub fn finish_with_message(&self, msg: impl Into<String>)
pub fn finish_with_message(&self, msg: impl Into<String>)
Mark the bar as finished, attaching a final summary message.
Sourcepub fn finish_and_clear(&self)
pub fn finish_and_clear(&self)
Finish and remove the bar from the terminal entirely (pristine output).
pub fn set_unit(&self, unit: impl Into<String>)
Sourcepub fn set_gradient(&mut self, gradient: Option<Gradient>)
pub fn set_gradient(&mut self, gradient: Option<Gradient>)
Change the gradient (or set None for the classic two-tone bar).
Sourcepub fn set_bar_width(&mut self, width: usize)
pub fn set_bar_width(&mut self, width: usize)
Set the number of columns the gradient bar occupies.
Sourcepub fn inner(&self) -> &ProgressBar
pub fn inner(&self) -> &ProgressBar
Borrow the underlying indicatif::ProgressBar for advanced use.