Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ProgressBar: Add with_elapsed for overridding elapsed time #325

Merged
merged 1 commit into from Nov 17, 2021

Conversation

zhaofengli
Copy link
Contributor

This PR adds ProgressBar::with_elapsed() which provides a way to override the elapsed time of a progress bar.

This is useful for scenarios where you dynamically create additional ProgressBars for "sub-tasks" and want to preserve the elapsed time in the output. Since ProgressBar exposes the elapsed time as a Duration, with_elapsed is more ergonomic than with_start_time.

@djc djc merged commit 5a38ab7 into console-rs:main Nov 17, 2021
@djc
Copy link
Collaborator

djc commented Nov 17, 2021

Thanks, this makes sense! (In particular, thanks for the pre-emptive note about the with_start_time() alternative.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants