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: String,
style: BarStyle,
gradient: Option<Gradient>,
) -> Self
pub fn new( len: u64, msg: String, style: BarStyle, gradient: Option<Gradient>, ) -> Self
Create a bar with a known total, an explicit layout and an explicit style (gradient or not).
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).
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.
Trait Implementations§
Source§impl Clone for GradientProgressBar
impl Clone for GradientProgressBar
Source§fn clone(&self) -> GradientProgressBar
fn clone(&self) -> GradientProgressBar
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more