pub trait ConstMultiple:
Sized
+ ConstZero
+ Rem<Output = Self>
+ Add<Output = Self>
+ Sub<Output = Self>
+ Eq {
// Required methods
fn is_multiple_of(&self, rhs: &Self) -> bool;
fn next_multiple_of(self, rhs: Self) -> Self;
fn checked_next_multiple_of(self, rhs: Self) -> Option<Self>;
}Expand description
Const-compatible multiple-of operations.
§Unsigned types only
This trait is designed for unsigned integer types.
Required Methods§
Sourcefn is_multiple_of(&self, rhs: &Self) -> bool
fn is_multiple_of(&self, rhs: &Self) -> bool
Returns true if self is a multiple of rhs.
Returns false if rhs is zero.
Sourcefn next_multiple_of(self, rhs: Self) -> Self
fn next_multiple_of(self, rhs: Self) -> Self
Returns the smallest value greater than or equal to self that
is a multiple of rhs.
§Panics
Panics if rhs is zero, or if the result would overflow.
Sourcefn checked_next_multiple_of(self, rhs: Self) -> Option<Self>
fn checked_next_multiple_of(self, rhs: Self) -> Option<Self>
Returns the smallest value greater than or equal to self that
is a multiple of rhs.
Returns None if rhs is zero, or if the result would overflow.
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.