pub trait WrappingRem: Sized + Rem<Self> {
// Required method
fn wrapping_rem(self, v: Self) -> <Self as Rem<Self>>::Output;
}Expand description
Performs a remainder operation that wraps around on overflow.
Required Methods§
Sourcefn wrapping_rem(self, v: Self) -> <Self as Rem<Self>>::Output
fn wrapping_rem(self, v: Self) -> <Self as Rem<Self>>::Output
Wrapping (modular) remainder. Computes self % other, wrapping around
at the boundary of the type.
The only case where such wrapping can occur is MIN % -1 on a signed
type, where the remainder is defined to be 0. For unsigned types this
is a normal remainder and can never wrap.
§Panics
Panics if other is zero.
use const_num_traits::WrappingRem;
assert_eq!(WrappingRem::wrapping_rem(100i8, 10), 0);
assert_eq!(WrappingRem::wrapping_rem(i8::MIN, -1), 0); // wrapped!Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".