-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Implement Display for Duration. #29146
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
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @alexcrichton (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. The way Github handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
@SimonSapin If you don't use a different unit, then Display will be useless for most uses, because it will only be appropriate for durations of a scale that makes sense with the unit you chose. |
I do think this type should implement For example, if I have a 3 nanosecond duration it seems like the "most readable" representation would be along the lines of |
The libs team discussed this during triage yesterday, and the conclusion was that we probably don't actually want a As a result I'm going to close this for now, but we also decided we'd be fine with an unstable method returning a display-able adapter, so feel free to open a PR with that! |
Ah and another point brought up by @brson is that once you start dealing with time + printing the question of locales can come into play, so we either need to have a story around that or ensure that we're stepping around the problem. |
… or was there a reason not to do it?
r? @alexcrichton