num_modular

Trait DivExact

Source
pub trait DivExact<Rhs, Precompute>: Sized {
    type Output;

    // Required method
    fn div_exact(self, d: Rhs, pre: &Precompute) -> Option<Self::Output>;
}
Expand description

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§

Source

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", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl DivExact<u8, ()> for u8

Source§

type Output = u8

Source§

fn div_exact(self, d: u8, _: &()) -> Option<Self::Output>

Source§

impl DivExact<u8, PreModInv<u8>> for u8

Source§

type Output = u8

Source§

fn div_exact(self, d: u8, pre: &PreModInv<u8>) -> Option<Self>

Source§

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

Source§

type Output = u16

Source§

fn div_exact(self, d: u8, pre: &PreModInv<u8>) -> Option<Self::Output>

Source§

impl DivExact<u8, PreMulInv1by1<u8>> for u8

Source§

type Output = u8

Source§

fn div_exact(self, d: u8, pre: &PreMulInv1by1<u8>) -> Option<Self::Output>

Source§

impl DivExact<u16, ()> for u16

Source§

type Output = u16

Source§

fn div_exact(self, d: u16, _: &()) -> Option<Self::Output>

Source§

impl DivExact<u16, PreModInv<u16>> for u16

Source§

type Output = u16

Source§

fn div_exact(self, d: u16, pre: &PreModInv<u16>) -> Option<Self>

Source§

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

Source§

type Output = u32

Source§

fn div_exact(self, d: u16, pre: &PreModInv<u16>) -> Option<Self::Output>

Source§

impl DivExact<u16, PreMulInv1by1<u16>> for u16

Source§

type Output = u16

Source§

fn div_exact(self, d: u16, pre: &PreMulInv1by1<u16>) -> Option<Self::Output>

Source§

impl DivExact<u32, ()> for u32

Source§

type Output = u32

Source§

fn div_exact(self, d: u32, _: &()) -> Option<Self::Output>

Source§

impl DivExact<u32, PreModInv<u32>> for u32

Source§

type Output = u32

Source§

fn div_exact(self, d: u32, pre: &PreModInv<u32>) -> Option<Self>

Source§

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

Source§

type Output = u64

Source§

fn div_exact(self, d: u32, pre: &PreModInv<u32>) -> Option<Self::Output>

Source§

impl DivExact<u32, PreMulInv1by1<u32>> for u32

Source§

type Output = u32

Source§

fn div_exact(self, d: u32, pre: &PreMulInv1by1<u32>) -> Option<Self::Output>

Source§

impl DivExact<u64, ()> for u64

Source§

type Output = u64

Source§

fn div_exact(self, d: u64, _: &()) -> Option<Self::Output>

Source§

impl DivExact<u64, PreModInv<u64>> for u64

Source§

type Output = u64

Source§

fn div_exact(self, d: u64, pre: &PreModInv<u64>) -> Option<Self>

Source§

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

Source§

type Output = u128

Source§

fn div_exact(self, d: u64, pre: &PreModInv<u64>) -> Option<Self::Output>

Source§

impl DivExact<u64, PreMulInv1by1<u64>> for u64

Source§

type Output = u64

Source§

fn div_exact(self, d: u64, pre: &PreMulInv1by1<u64>) -> Option<Self::Output>

Source§

impl DivExact<u128, ()> for u128

Source§

type Output = u128

Source§

fn div_exact(self, d: u128, _: &()) -> Option<Self::Output>

Source§

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

Source§

type Output = u128

Source§

fn div_exact(self, d: usize, pre: &PreModInv<usize>) -> Option<Self::Output>

Source§

impl DivExact<usize, PreModInv<usize>> for usize

Source§

type Output = usize

Source§

fn div_exact(self, d: usize, pre: &PreModInv<usize>) -> Option<Self>

Source§

impl DivExact<usize, PreMulInv1by1<usize>> for usize

Implementors§