Trait Mod

Source
pub trait Mod<T: Nat>: Nat {
    type Result: Nat;
}
Expand description

§Remainders

GCD is left as an exercise for the reader…

assert_eq!(<Five as Mod<Three>>::Result::eval(), 2);
assert_eq!(<Ten as Mod<Two>>::Result::eval(), 0);
assert_eq!(<Seven as Mod<Nine>>::Result::eval(), 7);
assert_eq!(<Six as Mod<Six>>::Result::eval(), 0);

Required Associated Types§

Implementors§

Source§

impl<T: Nat> Mod<T> for Zero

Source§

impl<T: Nat, U: Nat, V, W: Nat, C: Bool> Mod<T> for Succ<U>
where Self: Minus<T, Result = V> + LessThan<T, Result = C>, V: Mod<T> + Nat, (Self, <V as Mod<T>>::Result): If<C, Result = W>,