Trait Times

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

§Multiplication

It’s time to get timesing at compile-time! That sounded way cooler in my head.

assert_eq!(<Four as Times<Three>>::Result::eval(), 12);
assert_eq!(<Seven as Times<One>>::Result::eval(), 7);
assert_eq!(<Three as Times<Three>>::Result::eval(), 9);
assert_eq!(<Two as Times<Three>>::Result::eval(), 6);
assert_eq!(<Six as Times<Seven>>::Result::eval(), 42);

Required Associated Types§

Implementors§

Source§

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

Source§

impl<T: Nat, U, V> Times<T> for Succ<U>
where U: Times<T, Result = V> + Nat, V: Plus<T> + Nat,

Source§

type Result = <V as Plus<T>>::Result