-
-
Notifications
You must be signed in to change notification settings - Fork 14.5k
Closed
Labels
C-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: 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.Relevant to the library API team, which will review and decide on the PR/issue.
Description
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.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
C-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: 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.Relevant to the library API team, which will review and decide on the PR/issue.