Skip to content

Commit

Permalink
Support increasing the length of the progress bar with a delta. (#110)
Browse files Browse the repository at this point in the history
This is useful when new work arrives when tracking the progress of existing work.
  • Loading branch information
tomtung authored and mitsuhiko committed Sep 7, 2019
1 parent 8f9cb2e commit 342e43a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/progress.rs
Expand Up @@ -554,6 +554,13 @@ impl ProgressBar {
})
}

/// Increase the length of the progress bar.
pub fn inc_length(&self, delta: u64) {
self.update_and_draw(|state| {
state.len = state.len.saturating_add(delta);
})
}

/// Sets the current prefix of the progress bar.
pub fn set_prefix(&self, prefix: &str) {
let prefix = prefix.to_string();
Expand Down

0 comments on commit 342e43a

Please sign in to comment.