pub trait LocalInteger:
Sized
+ Eq
+ LocalNum {
// Required methods
fn gcd(&self, other: &Self) -> Self;
fn lcm(&self, other: &Self) -> Self;
fn is_multiple_of(&self, other: &Self) -> bool;
// Provided methods
fn gcd_lcm(&self, other: &Self) -> (Self, Self) { ... }
fn div_rem(self, other: Self) -> (Self, Self)
where Self: Clone { ... }
fn dec(&mut self)
where Self: Clone { ... }
fn inc(&mut self)
where Self: Clone { ... }
}Expand description
A LocalNum that allows division, remainder, GCD, and LCM
This is something like a Euclidean domain, but do not expect it to be mathematically equivalent.
Required Methods§
Sourcefn is_multiple_of(&self, other: &Self) -> bool
fn is_multiple_of(&self, other: &Self) -> bool
Returns true if self is a multiple of other
Provided Methods§
Sourcefn gcd_lcm(&self, other: &Self) -> (Self, Self)
fn gcd_lcm(&self, other: &Self) -> (Self, Self)
Greatest Common Divisor (GCD) and Lowest Common Multiple (LCM) together
Potentially more efficient than calling gcd and lcm
individually for identical inputs.
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.