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

Formatter with automatic prefixes #438

Open
sixties opened this issue Aug 31, 2023 · 3 comments
Open

Formatter with automatic prefixes #438

sixties opened this issue Aug 31, 2023 · 3 comments

Comments

@sixties
Copy link

sixties commented Aug 31, 2023

Is there a possibilty to display quantities with automatic "human readable" prefixes? Example: 0.1 s -> 100 ms.
As a human one typically chooses the prefix such that that there are 1..3 digits displayed before the fractional part. Maybe one could implement this as an additional DisplayStyle.

@iliekturtles
Copy link
Owner

There isn't any functionality like this currently. I'm not sure if this should be in scope to be directly in uom, so I'll leave the issue open for consideration.

@baarkerlounger
Copy link
Contributor

Additional human readable formatting options might also be useful for time quantities where you might expect to see eg. 2:30 rather than 2.5 mins or similar .

@YgorSouza
Copy link

As a human one typically chooses the prefix such that that there are 1..3 digits displayed before the fractional part

This is called Engineering notation. Rust formats the Duration type like this. But it mostly applies to SI units, so I think it would be hard to reasonably implement something like that in this crate, which is far more general.

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

No branches or pull requests

4 participants