Skip to main content

ProgressBar

Struct ProgressBar 

Source
pub struct ProgressBar { /* private fields */ }
Available on crate feature print only.
Expand description

Handle for a progress bar (This is the internal state, the handle is Arc<ProgressBar>)

See Progress Bars

Implementations§

Source§

impl ProgressBar

Source

pub fn set_total(&self, total: u64)

Set the total steps (if the progress is finite)

Source

pub fn child(self: &Arc<Self>, message: impl Into<String>) -> ProgressBarBuilder

Start building a child progress bar

Note that the child builder will keep this bar alive (displayed), even if the child is not spawned

Source

pub fn done_with_message(self: Arc<Self>, message: &str)

Set the message to be printed and mark the bar as done

Source

pub fn done_by_ref_with_message(&self, message: &str)

Set the message to be printed and mark the bar as done

Source

pub fn set_done_message(&self, message: &str)

Change the message to be printed when the bar is done. Useful if information is not available yet when the bar is spawned.

This does NOT mark the bar as done, use done_with_message for that.

Source

pub fn set_interrupted_message(&self, message: &str)

Change the message to be printed when the bar is interrupted. Useful if information is not available yet when the bar is spawned.

Source

pub fn done(self: Arc<Self>)

Mark the progress bar as done and drop the handle.

This needs to be called if the bar is unbounded. Otherwise, the bar will display in the interrupted state when dropped.

If the progress is finite, then interrupted state is automatically determined (current != total)

Source

pub fn done_by_ref(&self)

Same as done, but does not drop the bar.

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 Drop for ProgressBar

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

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.

§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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, <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.