Skip to main content

WrappingRem

Trait WrappingRem 

Source
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§

Source

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".

Implementations on Foreign Types§

Source§

impl WrappingRem for i8

Source§

fn wrapping_rem(self, v: Self) -> Self

Source§

impl WrappingRem for i16

Source§

fn wrapping_rem(self, v: Self) -> Self

Source§

impl WrappingRem for i32

Source§

fn wrapping_rem(self, v: Self) -> Self

Source§

impl WrappingRem for i64

Source§

fn wrapping_rem(self, v: Self) -> Self

Source§

impl WrappingRem for i128

Source§

fn wrapping_rem(self, v: Self) -> Self

Source§

impl WrappingRem for isize

Source§

fn wrapping_rem(self, v: Self) -> Self

Source§

impl WrappingRem for u8

Source§

fn wrapping_rem(self, v: Self) -> Self

Source§

impl WrappingRem for u16

Source§

fn wrapping_rem(self, v: Self) -> Self

Source§

impl WrappingRem for u32

Source§

fn wrapping_rem(self, v: Self) -> Self

Source§

impl WrappingRem for u64

Source§

fn wrapping_rem(self, v: Self) -> Self

Source§

impl WrappingRem for u128

Source§

fn wrapping_rem(self, v: Self) -> Self

Source§

impl WrappingRem for usize

Source§

fn wrapping_rem(self, v: Self) -> Self

Implementors§