Struct MultiProgress
struct MultiProgress { ... }
Manages multiple progress bars from different threads
Implementations
impl MultiProgress
fn new() -> SelfCreates 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) -> SelfCreates 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_targetto 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) -> ProgressBarAdds 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
ProgressDrawTargetsettings.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
MultiProgresswill have no effect.fn insert(self: &Self, index: usize, pb: ProgressBar) -> ProgressBarInserts a progress bar.
The progress bar inserted at position
indexwill have the draw target changed to a remote draw target that is intercepted by the multi progress object overriding customProgressDrawTargetsettings.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
MultiProgresswill have no effect.fn insert_from_back(self: &Self, index: usize, pb: ProgressBar) -> ProgressBarInserts a progress bar from the back.
The progress bar inserted at position
MultiProgressState::objects.len() - indexwill have the draw target changed to a remote draw target that is intercepted by the multi progress object overriding customProgressDrawTargetsettings.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
MultiProgresswill have no effect.fn insert_before(self: &Self, before: &ProgressBar, pb: ProgressBar) -> ProgressBarInserts 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
ProgressDrawTargetsettings.Inserting a progress bar that is already a member of the
MultiProgresswill have no effect.fn insert_after(self: &Self, after: &ProgressBar, pb: ProgressBar) -> ProgressBarInserts 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
ProgressDrawTargetsettings.Inserting a progress bar that is already a member of the
MultiProgresswill 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::insertorMultiProgress::add. If the passed progress bar does not satisfy the condition above, theremovemethod does nothing.fn println<I: AsRef<str>>(self: &Self, msg: I) -> Result<()>Print a log line above all progress bars in the
MultiProgressIf 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) -> RHide all progress bars temporarily, execute
f, then redraw theMultiProgressExecutes '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
fis executed. Other threads trying to print anything on the progress bar will be blocked untilffinishes. Therefore, it is recommended to avoid long-running operations inf.fn clear(self: &Self) -> Result<()>
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) -> TReturns the argument unchanged.
impl<T> ToOwned for MultiProgress
fn to_owned(self: &Self) -> Tfn clone_into(self: &Self, target: &mut T)
impl<T, U> Into for MultiProgress
fn into(self: Self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses 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>