Barrettable

Trait Barrettable 

Source
pub trait Barrettable:
    Sized
    + Copy
    + PartialOrd
    + Zero
    + One
    + Add<Output = Self>
    + Sub<Output = Self>
    + Mul<Output = Self> {
    // Required methods
    fn inv_mod_approx(m: Self) -> Self;
    fn div_approx(self, im: Self) -> Self;

    // Provided method
    fn barrett_reduce(self, m: Self, im: Self) -> (Self, Self) { ... }
}

Required Methods§

Source

fn inv_mod_approx(m: Self) -> Self

Source

fn div_approx(self, im: Self) -> Self

Provided Methods§

Source

fn barrett_reduce(self, m: Self, im: Self) -> (Self, Self)

Examples found in repository?
crates/competitive/src/num/barrett_reduction.rs (line 27)
26    pub fn div_rem(&self, a: T) -> (T, T) {
27        T::barrett_reduce(a, self.m, self.im)
28    }

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 Barrettable for u32

Source§

fn inv_mod_approx(m: Self) -> Self

Source§

fn div_approx(self, im: Self) -> Self

Source§

impl Barrettable for u64

Source§

fn inv_mod_approx(m: Self) -> Self

Source§

fn div_approx(self, im: Self) -> Self

Source§

impl Barrettable for u128

Source§

fn inv_mod_approx(m: Self) -> Self

Source§

fn div_approx(self, im: Self) -> Self

Implementors§