pub struct ProgressBar { /* private fields */ }Expand description
A progress bar widget.
Displays a horizontal bar showing progress. In determinate mode, the bar fills proportionally. In indeterminate mode, an animated wave pattern moves across the bar.
Implementations§
Source§impl ProgressBar
impl ProgressBar
Sourcepub fn new(progress: f32) -> Self
pub fn new(progress: f32) -> Self
Create a determinate progress bar.
Progress is clamped to 0.0..=1.0.
Sourcepub fn indeterminate() -> Self
pub fn indeterminate() -> Self
Create an indeterminate progress bar.
Sourcepub fn with_filled_style(self, style: Style) -> Self
pub fn with_filled_style(self, style: Style) -> Self
Set the filled portion style.
Sourcepub fn with_empty_style(self, style: Style) -> Self
pub fn with_empty_style(self, style: Style) -> Self
Set the empty portion style.
Sourcepub fn with_label_style(self, style: Style) -> Self
pub fn with_label_style(self, style: Style) -> Self
Set the percentage label style.
Sourcepub fn with_show_percentage(self, show: bool) -> Self
pub fn with_show_percentage(self, show: bool) -> Self
Enable or disable percentage display.
Sourcepub fn with_border(self, border: BorderStyle) -> Self
pub fn with_border(self, border: BorderStyle) -> Self
Set the border style.
Sourcepub fn set_progress(&mut self, progress: f32)
pub fn set_progress(&mut self, progress: f32)
Set the progress value (0.0 to 1.0, clamped).
Switches to determinate mode if currently indeterminate.
Sourcepub fn progress(&self) -> Option<f32>
pub fn progress(&self) -> Option<f32>
Get the current progress value.
Returns None if in indeterminate mode.
Sourcepub fn tick(&mut self)
pub fn tick(&mut self)
Advance the indeterminate animation phase.
In determinate mode, this is a no-op.
Sourcepub fn mode(&self) -> &ProgressMode
pub fn mode(&self) -> &ProgressMode
Get the current mode.
Trait Implementations§
Source§impl Widget for ProgressBar
impl Widget for ProgressBar
Source§fn render(&self, area: Rect, buf: &mut ScreenBuffer)
fn render(&self, area: Rect, buf: &mut ScreenBuffer)
Render this widget into the given area of the buffer.
Auto Trait Implementations§
impl Freeze for ProgressBar
impl RefUnwindSafe for ProgressBar
impl Send for ProgressBar
impl Sync for ProgressBar
impl Unpin for ProgressBar
impl UnwindSafe for ProgressBar
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