CheckRem

Trait CheckRem 

Source
pub trait CheckRem: Rem<Output = Self> + PartialEq
where Self: Copy + Default,
{ // Provided methods fn no_rem(&self, n: Self) -> bool { ... } fn is_rem(&self, n: Self) -> bool { ... } }
Available on crate feature get_rem only.
Expand description

Trait for checking the remainder.

Provided Methods§

Source

fn no_rem(&self, n: Self) -> bool

Returns true if there is no remainder.

§Panics

If the divisor is zero.

§Arguments
  • n - The divisor with which the remainder is checked.
§Examples
use num_convert::CheckRem;

assert_eq!(10.no_rem(2), true);
assert_eq!(10.no_rem(3), false);
Source

fn is_rem(&self, n: Self) -> bool

Returns true if there is a remainder.

§Arguments
  • n - The divisor with which the remainder is checked.
§Examples
use num_convert::CheckRem;

assert_eq!(10.is_rem(2), false);
assert_eq!(10.is_rem(3), true);

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<T> CheckRem for T
where T: Copy + Default + Rem<Output = T> + PartialEq,