I would definitely prefer a generic Checked
ala the one the checked
crate provides to the current approach of checked_*
, much like the Wrapping
type provides a more ergonomic alternative to the wrapping_*
methods.
That makes it possible to use core::ops::{Add, Sub, Mul, Div}
which also enables polymorphism with respect to the arguments.
Since that doesn't exist though, and NonZeroU*
has some of the checked_*
methods, filling out the rest makes sense for consistency's sake.
I'm not sure how the type signature would differ other than the rhs
operand, which is the u*
type mapping to the NonZeroU*
.