Skip to main content

ProgressBar

Struct ProgressBar 

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

A progress bar. Mirrors rich.progress_bar.ProgressBar.

Implementations§

Source§

impl ProgressBar

Source

pub fn new(total: f64, completed: f64) -> Self

A bar of completed out of total, with upstream’s default bar.* styles.

Source

pub fn indeterminate() -> Self

A bar with no total, which always pulses (upstream total=None).

Source

pub fn width(self, width: usize) -> Self

Fix the bar width (otherwise it fills the available width).

Source

pub fn style(self, style: impl Into<StyleType>) -> Self

The background style (upstream style, default bar.back).

Source

pub fn complete_style(self, style: impl Into<StyleType>) -> Self

The completed-part style (upstream complete_style, default bar.complete).

Source

pub fn finished_style(self, style: impl Into<StyleType>) -> Self

The style once finished (upstream finished_style, default bar.finished).

Source

pub fn pulse_style(self, style: impl Into<StyleType>) -> Self

The pulse style (upstream pulse_style, default bar.pulse).

Source

pub fn pulse(self, pulse: bool) -> Self

Render the pulse animation instead of the completion (upstream pulse).

Source

pub fn animation_time(self, time: f64) -> Self

The time, in seconds, the pulse is drawn at (upstream animation_time). Without it the pulse follows a monotonic clock.

Trait Implementations§

Source§

impl Renderable for ProgressBar

Source§

fn measure(&self, _console: &Console, options: &ConsoleOptions) -> Measurement

Port of ProgressBar.__rich_measure__: a fixed width measures exactly, otherwise the bar takes 4 cells up to the whole width.

Source§

fn rich_render( &self, console: &Console, options: &ConsoleOptions, ) -> Vec<Segment>

Source§

fn fit_to_measurement(&self) -> bool

Whether a top-level Console::print shrinks this renderable to its measured width. Upstream renders every top-level renderable at the full console width, so the default is false; an extension may opt in.

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.