Skip to content

Commit

Permalink
ProgressBar: Add with_elapsed for overridding elapsed time
Browse files Browse the repository at this point in the history
  • Loading branch information
zhaofengli authored and djc committed Nov 17, 2021
1 parent c43d7b3 commit 5a38ab7
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/progress_bar.rs
Expand Up @@ -77,6 +77,12 @@ impl ProgressBar {
self
}

/// A convenience builder-like function for a progress bar with a given elapsed time
pub fn with_elapsed(self, elapsed: Duration) -> ProgressBar {
self.state.lock().unwrap().started = Instant::now() - elapsed;
self
}

/// Creates a new spinner
///
/// This spinner by default draws directly to stderr. This adds the default spinner style to it.
Expand Down

0 comments on commit 5a38ab7

Please sign in to comment.