This PR adds support for NonZero types, which is part of std::num.
I tried using NonZero<T>, but ZeroablePrimitive is a nightly trait, so used a macro instead. It raises an ArgumentError if the value is zero, but I think a TypeError would work as well.
Edit: Switched to NonZeroI8, NonZeroI16, etc. since NonZero<T> is not available in 1.61.
This PR adds support for NonZero types, which is part of
std::num
.I tried using
NonZero<T>
, butZeroablePrimitive
is a nightly trait, so used a macro instead. It raises anArgumentError
if the value is zero, but I think aTypeError
would work as well.Edit: Switched to
NonZeroI8
,NonZeroI16
, etc. sinceNonZero<T>
is not available in 1.61.