Skip to content

[feature request] adding {percent_precise} style key#628

Merged
djc merged 1 commit intoconsole-rs:mainfrom
OmarTawfik-forks:precision-precise
Feb 8, 2024
Merged

[feature request] adding {percent_precise} style key#628
djc merged 1 commit intoconsole-rs:mainfrom
OmarTawfik-forks:precision-precise

Conversation

@OmarTawfik
Copy link
Copy Markdown
Contributor

The existing {percent} is rendered as an integer, which means it is not very useful for large data sets, as it rarely changes.

I suggest adding a new {percent_precise} (a non-breaking change?) that would render it with additional precision. For example 3 fraction digits, as demonstrated by the test added here.

An earlier proposal to add precision to variables was rejected (#552), and AFAIK, there is no way to customize this without taking over rendering. I think this proposal would work well with existing variables like elapsed_precise, eta_precise.

Thanks for considering!

The existing `{percent}` is rendered as an integer, which means it is not very useful for large data sets, as it rarely changes.

I suggest adding a new `{percent_precise}` (a non-breaking change?) that would render it with additional precision. For example, 3 fraction digits, as demonstrated by the test added here.

An earlier proposal to add precision to variables was rejected (#552), and AFAIK, there is no way to customize this without taking over rendering.

I think it would work well with existing variables like `elapsed_precise`, `eta_precise`.

Thanks for considering!
Copy link
Copy Markdown
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.

Seems okay. @chris-laplante what do you think?

(Note that this can be done using a custom ProgressTracker implementation.)

@chris-laplante
Copy link
Copy Markdown
Collaborator

Seems okay. @chris-laplante what do you think?

(Note that this can be done using a custom ProgressTracker implementation.)

I think it's a common enough use case that we shouldn't force people to use ProgressTracker. So +1 from me.

@djc djc merged commit f8d33f9 into console-rs:main Feb 8, 2024
@OmarTawfik OmarTawfik deleted the precision-precise branch February 8, 2024 16:29
@OmarTawfik
Copy link
Copy Markdown
Contributor Author

@djc @chris-laplante
Thanks for looking into this! I wonder when do new released get pushed to crates.io?

@djc
Copy link
Copy Markdown
Member

djc commented Feb 9, 2024

More or less by request: #629.

@OmarTawfik
Copy link
Copy Markdown
Contributor Author

OmarTawfik commented Feb 9, 2024

@djc looks like the deployment failed (job) 😞
One test (style::tests::wide_element_style) randomly failed. Not sure why, although it succeeded in other jobs in the matrix, and with the same toolchain on the previous commit. I don't have permissions to rerun the job, but please let me know if I can debug/help with anything otherwise to unblock publishing.

@chris-laplante
Copy link
Copy Markdown
Collaborator

@djc looks like the deployment failed (job) 😞 One test (style::tests::wide_element_style) randomly failed. Not sure why, although it succeeded in other jobs in the matrix, and with the same toolchain on the previous commit. I don't have permissions to rerun the job, but please let me know if I can debug/help with anything otherwise to unblock publishing.

It is unrelated to your changes - it failed a few days ago as well: #631

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.

3 participants