Skip to main content

ProgressBar

Struct ProgressBar 

Source
pub struct ProgressBar { /* private fields */ }
Expand description

A horizontal progress bar widget.

Implementations§

Source§

impl ProgressBar

Source

pub fn new(bounds: Rect) -> Self

Create a new progress bar with the given bounds.

Source

pub const fn with_config(bounds: Rect, config: ProgressBarConfig) -> Self

Create a new progress bar with custom configuration.

Source

pub const fn set_progress(&mut self, progress: f32)

Set the progress value (clamped to 0.0-1.0).

Source

pub const fn progress(&self) -> f32

Get the current progress value.

Source

pub fn set_label(&mut self, label: impl Into<String>)

Set the label text.

Source

pub fn clear_label(&mut self)

Clear the label.

Source

pub fn increment(&mut self, delta: f32)

Increment progress by a delta (clamped).

Source

pub fn is_complete(&self) -> bool

Check if progress is complete (>= 1.0).

Trait Implementations§

Source§

impl Debug for ProgressBar

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Widget for ProgressBar

Source§

fn bounds(&self) -> Rect

Get the current bounds of this widget.
Source§

fn set_bounds(&mut self, bounds: Rect)

Set the bounds of this widget. Read more
Source§

fn render(&self, buffer: &mut Buffer)

Render this widget to the given buffer. Read more
Source§

fn handle_input(&mut self, _event: &InputEvent) -> bool

Handle an input event. Read more
Source§

fn needs_redraw(&self) -> bool

Check if this widget needs to be redrawn.
Source§

fn clear_redraw(&mut self)

Clear the redraw flag after rendering.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.