File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -423,6 +423,17 @@ impl ProgressBar {
423
423
state. draw_target = target;
424
424
}
425
425
426
+ /// Force a redraw of the progress bar to be in sync with its state
427
+ ///
428
+ /// For performance reasons the progress bar is not redrawn on each state update.
429
+ /// This is normally not an issue, since new updates will eventually trigger rendering.
430
+ ///
431
+ /// For slow running tasks it is recommended to rely on [`ProgressBar::enable_steady_tick()`]
432
+ /// to ensure continued rendering of the progress bar.
433
+ pub fn force_draw ( & self ) {
434
+ let _ = self . state ( ) . draw ( true , Instant :: now ( ) ) ;
435
+ }
436
+
426
437
/// Hide the progress bar temporarily, execute `f`, then redraw the progress bar
427
438
///
428
439
/// Useful for external code that writes to the standard output.
You can’t perform that action at this time.
0 commit comments