-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Adding is_zero() to core::time::Duration #2809
Comments
For simple additions like this, you can just submit a pull request to get it added. But why do we need this? How would you implement this? |
Though it is trivial to do with |
I don't think this is sufficient motivation though. Integers, floats and co. don't have a .is_zero() either. What is this actually used for? |
Integers can be compared to let flag: u8 = ...;
if flag > 0 {
// ...
} A |
It seems in line with the various |
Thanks for your input. However English is not my first language, so I'm not sure. |
My point was that It would be nice to find a different word besides "zero" though. We have Another possibility is creating a |
I followed full procedure and made this pull request: #2814 |
Closing this for the same reason as #2814 – it is not necessary to go through the full RFC process for this small addition. |
Hello Rust developers,
I apologize beforehand because I think this is a simple RFC, so I'm not going through full requirements of an RFC issue.
Would you please consider adding new function (below) to
core::time::Duration
?When taking options from users, I find myself many times the need to check if a duration is zero. Perhaps it could be the same for other developers.
Thank you very much for your hard work,
The text was updated successfully, but these errors were encountered: