Skip to main content

DivExactAssign

Trait DivExactAssign 

Source
pub trait DivExactAssign<Rhs, Precompute>: Sized {
    // Required method
    fn div_exact_assign(&mut self, d: Rhs, pre: &Precompute) -> bool;
}
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). In-place exact division, with precomputed helper values

This is the assign version of DivExact: if d divides self, self is replaced by the quotient and true is returned; otherwise self is unchanged and false is returned.

Required Methods§

Source

fn div_exact_assign(&mut self, d: Rhs, pre: &Precompute) -> bool

Check if d divides self with the help of the precomputation. If d divides self, self is replaced by the quotient and true is returned.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl DivExactAssign<u8, ()> for u8

Source§

fn div_exact_assign(&mut self, d: u8, pre: &()) -> bool

Source§

impl DivExactAssign<u8, PreModInv<u8>> for u8

Source§

fn div_exact_assign(&mut self, d: u8, pre: &PreModInv<u8>) -> bool

Source§

impl DivExactAssign<u8, PreModInv<u8>> for u16

Source§

fn div_exact_assign(&mut self, d: u8, pre: &PreModInv<u8>) -> bool

Source§

impl DivExactAssign<u8, PreMulInv1by1<u8>> for u8

Source§

fn div_exact_assign(&mut self, d: u8, pre: &PreMulInv1by1<u8>) -> bool

Source§

impl DivExactAssign<u16, ()> for u16

Source§

fn div_exact_assign(&mut self, d: u16, pre: &()) -> bool

Source§

impl DivExactAssign<u16, PreModInv<u16>> for u16

Source§

fn div_exact_assign(&mut self, d: u16, pre: &PreModInv<u16>) -> bool

Source§

impl DivExactAssign<u16, PreModInv<u16>> for u32

Source§

fn div_exact_assign(&mut self, d: u16, pre: &PreModInv<u16>) -> bool

Source§

impl DivExactAssign<u16, PreMulInv1by1<u16>> for u16

Source§

fn div_exact_assign(&mut self, d: u16, pre: &PreMulInv1by1<u16>) -> bool

Source§

impl DivExactAssign<u32, ()> for u32

Source§

fn div_exact_assign(&mut self, d: u32, pre: &()) -> bool

Source§

impl DivExactAssign<u32, PreModInv<u32>> for u32

Source§

fn div_exact_assign(&mut self, d: u32, pre: &PreModInv<u32>) -> bool

Source§

impl DivExactAssign<u32, PreModInv<u32>> for u64

Source§

fn div_exact_assign(&mut self, d: u32, pre: &PreModInv<u32>) -> bool

Source§

impl DivExactAssign<u32, PreMulInv1by1<u32>> for u32

Source§

fn div_exact_assign(&mut self, d: u32, pre: &PreMulInv1by1<u32>) -> bool

Source§

impl DivExactAssign<u64, ()> for u64

Source§

fn div_exact_assign(&mut self, d: u64, pre: &()) -> bool

Source§

impl DivExactAssign<u64, PreModInv<u64>> for u64

Source§

fn div_exact_assign(&mut self, d: u64, pre: &PreModInv<u64>) -> bool

Source§

impl DivExactAssign<u64, PreModInv<u64>> for u128

Source§

fn div_exact_assign(&mut self, d: u64, pre: &PreModInv<u64>) -> bool

Source§

impl DivExactAssign<u64, PreMulInv1by1<u64>> for u64

Source§

fn div_exact_assign(&mut self, d: u64, pre: &PreMulInv1by1<u64>) -> bool

Source§

impl DivExactAssign<u128, ()> for u128

Source§

fn div_exact_assign(&mut self, d: u128, pre: &()) -> bool

Source§

impl DivExactAssign<usize, PreModInv<usize>> for u128

Source§

fn div_exact_assign(&mut self, d: usize, pre: &PreModInv<usize>) -> bool

Source§

impl DivExactAssign<usize, PreModInv<usize>> for usize

Source§

fn div_exact_assign(&mut self, d: usize, pre: &PreModInv<usize>) -> bool

Source§

impl DivExactAssign<usize, PreMulInv1by1<usize>> for usize

Implementors§