You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
larsluthman opened this issue
Jun 23, 2020
· 3 comments
Labels
C-enhancementCategory: An issue proposing an enhancement or a PR with one.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.
std::num::NonZeroUsize does not implement the trait std::convert::TryFrom<usize>, and the same goes for all the other NonZero types - they don't implement TryFrom conversions from their inner type. This seems to be exactly the sort of situation that TryFrom was created for, so they probably should.
The NonZeroUsize::new() method already does something similar by returning None if the value is zero, but having TryFrom would be nice for consistency and for generic code.
The text was updated successfully, but these errors were encountered:
Thanks! I searched the issues before adding this one but didn't think to also search the pull requests. Will do that next time.
LeSeulArtichaut
added
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
T-libs-api
Relevant to the library API team, which will review and decide on the PR/issue.
and removed
C-bug
Category: This is a bug.
labels
Jun 24, 2020
C-enhancementCategory: An issue proposing an enhancement or a PR with one.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.
std::num::NonZeroUsize
does not implement the traitstd::convert::TryFrom<usize>
, and the same goes for all the otherNonZero
types - they don't implementTryFrom
conversions from their inner type. This seems to be exactly the sort of situation thatTryFrom
was created for, so they probably should.The
NonZeroUsize::new()
method already does something similar by returningNone
if the value is zero, but havingTryFrom
would be nice for consistency and for generic code.The text was updated successfully, but these errors were encountered: