pub struct Progress {
pub width: usize,
pub full_char: char,
pub full_color: String,
pub empty_char: char,
pub empty_color: String,
pub show_percentage: bool,
pub percent_format: String,
pub percentage_style: Style,
/* private fields */
}Expand description
Progress bar model.
Fields§
§width: usizeTotal width of the progress bar.
full_char: charCharacter for filled sections.
full_color: StringColor for filled sections (when not using gradient).
empty_char: charCharacter for empty sections.
empty_color: StringColor for empty sections.
show_percentage: boolWhether to show percentage text.
percent_format: StringFormat string for percentage.
percentage_style: StyleStyle for percentage text.
Implementations§
Source§impl Progress
impl Progress
Sourcepub fn with_gradient() -> Self
pub fn with_gradient() -> Self
Creates a progress bar with default gradient colors.
Sourcepub fn with_gradient_colors(color_a: &str, color_b: &str) -> Self
pub fn with_gradient_colors(color_a: &str, color_b: &str) -> Self
Creates a progress bar with custom gradient colors.
Sourcepub fn with_scaled_gradient(color_a: &str, color_b: &str) -> Self
pub fn with_scaled_gradient(color_a: &str, color_b: &str) -> Self
Creates a progress bar with a scaled gradient.
Sourcepub fn fill_chars(self, full: char, empty: char) -> Self
pub fn fill_chars(self, full: char, empty: char) -> Self
Sets the fill characters.
Sourcepub fn solid_fill(self, color: &str) -> Self
pub fn solid_fill(self, color: &str) -> Self
Sets the solid fill color (disables gradient).
Sourcepub fn without_percentage(self) -> Self
pub fn without_percentage(self) -> Self
Disables percentage display.
Sourcepub fn set_spring_options(&mut self, frequency: f64, damping: f64)
pub fn set_spring_options(&mut self, frequency: f64, damping: f64)
Sets the spring animation parameters.
Sourcepub fn set_percent(&mut self, p: f64) -> Option<Cmd>
pub fn set_percent(&mut self, p: f64) -> Option<Cmd>
Sets the percentage and returns a command to start animation.
Sourcepub fn incr_percent(&mut self, v: f64) -> Option<Cmd>
pub fn incr_percent(&mut self, v: f64) -> Option<Cmd>
Increments the percentage.
Sourcepub fn decr_percent(&mut self, v: f64) -> Option<Cmd>
pub fn decr_percent(&mut self, v: f64) -> Option<Cmd>
Decrements the percentage.
Sourcepub fn is_animating(&self) -> bool
pub fn is_animating(&self) -> bool
Returns whether the progress bar is still animating.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Progress
impl !RefUnwindSafe for Progress
impl Send for Progress
impl Sync for Progress
impl Unpin for Progress
impl !UnwindSafe for Progress
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