Struct MultiProgress

struct MultiProgress { ... }

Manages multiple progress bars from different threads

Implementations

impl MultiProgress

fn new() -> Self

Creates a new multi progress object.

Progress bars added to this object by default draw directly to stderr, and refresh a maximum of 15 times a second. To change the refresh rate set the draw target to one with a different refresh rate.

fn with_draw_target(draw_target: ProgressDrawTarget) -> Self

Creates a new multi progress object with the given draw target.

fn set_draw_target(self: &Self, target: ProgressDrawTarget)

Sets a different draw target for the multiprogress bar.

Use MultiProgress::with_draw_target to set the draw target during creation.

fn set_move_cursor(self: &Self, move_cursor: bool)

Set whether we should try to move the cursor when possible instead of clearing lines.

This can reduce flickering, but do not enable it if you intend to change the number of progress bars.

fn set_alignment(self: &Self, alignment: MultiProgressAlignment)

Set alignment flag

fn add(self: &Self, pb: ProgressBar) -> ProgressBar

Adds a progress bar.

The progress bar added will have the draw target changed to a remote draw target that is intercepted by the multi progress object overriding custom ProgressDrawTarget settings.

The progress bar will be positioned below all other bars currently in the MultiProgress.

Adding a progress bar that is already a member of the MultiProgress will have no effect.

fn insert(self: &Self, index: usize, pb: ProgressBar) -> ProgressBar

Inserts a progress bar.

The progress bar inserted at position index will have the draw target changed to a remote draw target that is intercepted by the multi progress object overriding custom ProgressDrawTarget settings.

If index >= MultiProgressState::objects.len(), the progress bar is added to the end of the list.

Inserting a progress bar that is already a member of the MultiProgress will have no effect.

fn insert_from_back(self: &Self, index: usize, pb: ProgressBar) -> ProgressBar

Inserts a progress bar from the back.

The progress bar inserted at position MultiProgressState::objects.len() - index will have the draw target changed to a remote draw target that is intercepted by the multi progress object overriding custom ProgressDrawTarget settings.

If index >= MultiProgressState::objects.len(), the progress bar is added to the start of the list.

Inserting a progress bar that is already a member of the MultiProgress will have no effect.

fn insert_before(self: &Self, before: &ProgressBar, pb: ProgressBar) -> ProgressBar

Inserts a progress bar before an existing one.

The progress bar added will have the draw target changed to a remote draw target that is intercepted by the multi progress object overriding custom ProgressDrawTarget settings.

Inserting a progress bar that is already a member of the MultiProgress will have no effect.

fn insert_after(self: &Self, after: &ProgressBar, pb: ProgressBar) -> ProgressBar

Inserts a progress bar after an existing one.

The progress bar added will have the draw target changed to a remote draw target that is intercepted by the multi progress object overriding custom ProgressDrawTarget settings.

Inserting a progress bar that is already a member of the MultiProgress will have no effect.

fn remove(self: &Self, pb: &ProgressBar)

Removes a progress bar.

The progress bar is removed only if it was previously inserted or added by the methods MultiProgress::insert or MultiProgress::add. If the passed progress bar does not satisfy the condition above, the remove method does nothing.

fn println<I: AsRef<str>>(self: &Self, msg: I) -> Result<()>

Print a log line above all progress bars in the MultiProgress

If the draw target is hidden (e.g. when standard output is not a terminal), println() will not do anything.

fn suspend<F: FnOnce() -> R, R>(self: &Self, f: F) -> R

Hide all progress bars temporarily, execute f, then redraw the MultiProgress

Executes 'f' even if the draw target is hidden.

Useful for external code that writes to the standard output.

Note: The internal lock is held while f is executed. Other threads trying to print anything on the progress bar will be blocked until f finishes. Therefore, it is recommended to avoid long-running operations in f.

fn clear(self: &Self) -> Result<()>
fn is_hidden(self: &Self) -> bool

impl Clone for MultiProgress

fn clone(self: &Self) -> MultiProgress

impl Debug for MultiProgress

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

impl Default for MultiProgress

fn default() -> Self

impl Freeze for MultiProgress

impl RefUnwindSafe for MultiProgress

impl Send for MultiProgress

impl Sync for MultiProgress

impl Unpin for MultiProgress

impl UnsafeUnpin for MultiProgress

impl UnwindSafe for MultiProgress

impl<T> Any for MultiProgress

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for MultiProgress

fn borrow(self: &Self) -> &T

impl<T> BorrowMut for MultiProgress

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

impl<T> CloneToUninit for MultiProgress

unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)

impl<T> From for MultiProgress

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> ToOwned for MultiProgress

fn to_owned(self: &Self) -> T
fn clone_into(self: &Self, target: &mut T)

impl<T, U> Into for MultiProgress

fn into(self: Self) -> U

Calls U::from(self).

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

impl<T, U> TryFrom for MultiProgress

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

impl<T, U> TryInto for MultiProgress

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