Closed briansmith closed 4 months ago
I updated this to be cleaner. I also removed the #[cold]
since that's an unrelated change.
What about my suggestion above?
What about my suggestion above?
Sorry, I don't see it. Maybe it is still a draft?
Oh, oops. You are right.
Avoid the
From<NonZeroU32>
implementation in favor of a constructor that centralizes all the range checking in one place. Consistently useERRNO_NOT_POSITIVE
for nonpositive values andSelf::UNEXPECTED
for too-large values.Besides being more consistent in the range checking, this also reduces the boilerplate in callers, which makes it easier to maintain the ports to less-common operating systems.