pub trait DivExact<Rhs, Precompute>: Sized {
type Output;
// Required method
fn div_exact(self, d: Rhs, pre: &Precompute) -> Option<Self::Output>;
}Expand description
Exact division, re-exported from num-modular.
DivExact<Rhs, Precompute>::div_exact(self, rhs, pre) returns Some(self / rhs) when rhs
divides self exactly and None otherwise. dashu’s implementations use the empty
precomputation Precompute = () (pass &() at the call site). For arbitrary-precision types an
exact division avoids the general division’s normalization and remainder computation when the
divisor is small (e.g. dashu-int uses Hensel 2-adic division).
Utility function for exact division, with precomputed helper values
§Available Pre-computation types:
(): No pre-computation, the implementation relies on native integer division- PreModInv: With Pre-computed modular inverse
Required Associated Types§
Required Methods§
Sourcefn div_exact(self, d: Rhs, pre: &Precompute) -> Option<Self::Output>
fn div_exact(self, d: Rhs, pre: &Precompute) -> Option<Self::Output>
Check if d divides self with the help of the precomputation. If d divides self, then the quotient is returned.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".