Progress

Struct Progress 

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

Multi-task progress display.

Implementations§

Source§

impl Progress

Source

pub fn new() -> Self

Create a new progress display with default columns.

Source

pub fn with_columns(self, columns: Vec<Box<dyn ProgressColumn>>) -> Self

Set custom columns.

Source

pub fn add_task(&self, description: &str, total: Option<u64>) -> usize

Add a new task.

Source

pub fn advance(&self, task_id: usize, amount: u64)

Advance a task by the given amount.

Source

pub fn update(&self, task_id: usize, completed: u64)

Update a task’s completed count.

Source

pub fn finish(&self, task_id: usize)

Mark a task as finished.

Source

pub fn remove(&self, task_id: usize)

Remove a task.

Source

pub fn is_finished(&self) -> bool

Check if all tasks are finished.

Source

pub fn render_to_string(&self) -> String

Render the progress display.

Source

pub fn print(&self)

Print the progress to stdout (with cursor control for updates).

Trait Implementations§

Source§

impl Debug for Progress

Source§

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

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

impl Default for Progress

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Renderable for Progress

Source§

fn render(&self, _context: &RenderContext) -> Vec<Segment>

Render this object to a sequence of segments. Read more
Source§

fn min_width(&self) -> usize

Get the minimum width required to render this object.
Source§

fn max_width(&self) -> usize

Get the maximum/natural width of this object.

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> Measurable for T
where T: Renderable,

Source§

fn measure(&self, width: usize) -> Measurement

Measure this renderable at the given width.
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.