pub trait Factor{
const ZERO: Self;
// Required method
fn gcd(self, other: Self) -> Self;
// Provided methods
fn lcm(self, other: Self) -> Self { ... }
fn gcd_lcm(self, other: Self) -> (Self, Self) { ... }
fn gcd_bulk(r: impl IntoIterator<Item = Self>) -> Self { ... }
fn lcm_bulk(r: impl IntoIterator<Item = Self>) -> Self { ... }
fn signed(
f: impl Fn(Self, Self) -> Self,
r: impl IntoIterator<Item = Self>,
) -> Self
where Self: Neg<Output = Self> + PartialOrd + Ord { ... }
}Expand description
Finds the greatest common divisor (GCD) and the least common multiple (LCM).
Required Associated Constants§
Required Methods§
Provided Methods§
Sourcefn lcm(self, other: Self) -> Self
fn lcm(self, other: Self) -> Self
Finds the least common multiple (LCM) of self and other.
Calls Self::gcd_lcm() and discards GCD.
Sourcefn gcd_lcm(self, other: Self) -> (Self, Self)
fn gcd_lcm(self, other: Self) -> (Self, Self)
Returns (Self::gcd(), Self::lcm()) of self and other.
Calls Self::gcd() to find LCM.
Sourcefn gcd_bulk(r: impl IntoIterator<Item = Self>) -> Self
fn gcd_bulk(r: impl IntoIterator<Item = Self>) -> Self
Finds the GCD of iterator over Self.
Sourcefn lcm_bulk(r: impl IntoIterator<Item = Self>) -> Self
fn lcm_bulk(r: impl IntoIterator<Item = Self>) -> Self
Finds the LCM of iterator over Self.
Sourcefn signed(
f: impl Fn(Self, Self) -> Self,
r: impl IntoIterator<Item = Self>,
) -> Self
fn signed( f: impl Fn(Self, Self) -> Self, r: impl IntoIterator<Item = Self>, ) -> Self
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.