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

feat: allow constructing and setting the progress bar len to None #664

Merged
merged 2 commits into from
Nov 12, 2024

Conversation

cdellacqua
Copy link
Contributor

For situations where the length of a progress bar can only be discovered after some processing, it might be more appropriate to show an empty bar rather than a full one of length 0 (0/0 is represented with a ratio of 1.0).

This PR introduces a new constructor, ProgressBar::empty(), and a new method, ProgressBar::unset_length(). These two allow library users to have a length of None, which is represented as a ratio of 0.0, achieving the empty state.

Copy link
Member

@djc djc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this makes sense, thanks.

src/progress_bar.rs Outdated Show resolved Hide resolved
@djc djc merged commit e84863a into console-rs:main Nov 12, 2024
10 checks passed
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.

2 participants