pub struct ProgressBar { /* private fields */ }Expand description
A non-interactive progress bar.
Renders as [██████░░░░] 60% (or without the percentage if hidden).
The filled segment uses the theme’s accent color; the empty segment uses
the theme’s default border color.
Implementations§
Source§impl ProgressBar
impl ProgressBar
Sourcepub fn new(label: impl Into<String>, value: f32) -> Self
pub fn new(label: impl Into<String>, value: f32) -> Self
Create a new progress bar with the given label and value.
value is clamped to the range 0.0..=1.0.
Sourcepub fn width(self, width: u16) -> Self
pub fn width(self, width: u16) -> Self
Set the total bar width in columns (including brackets).
Sourcepub fn hide_percent(self) -> Self
pub fn hide_percent(self) -> Self
Hide the percentage label.
Trait Implementations§
Source§impl Component for ProgressBar
impl Component for ProgressBar
Source§fn render(&self, _width: u16) -> Result<Rendered, RenderError>
fn render(&self, _width: u16) -> Result<Rendered, RenderError>
Render this component into lines of text at the given width. Read more
Source§fn render_rect(&self, rect: Rect) -> Result<Rendered, RenderError>
fn render_rect(&self, rect: Rect) -> Result<Rendered, RenderError>
Render this component into a specific rectangular area. Read more
Source§fn handle_input(&mut self, _event: &Event) -> InputResult
fn handle_input(&mut self, _event: &Event) -> InputResult
Handle an input event (key press, resize, mouse, etc.). Read more
Source§fn wants_key_release(&self) -> bool
fn wants_key_release(&self) -> bool
Returns
true if this component wants to receive
KeyEventKind::Release events in addition to Press / Repeat. Read moreAuto Trait Implementations§
impl Freeze for ProgressBar
impl RefUnwindSafe for ProgressBar
impl Send for ProgressBar
impl Sync for ProgressBar
impl Unpin for ProgressBar
impl UnsafeUnpin 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