Skip to main content

Minus

Trait Minus 

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

§Saturating Subtraction

It’s 2:30AM and I’ve completely run out of snappy sales pitches. It’s subtraction - wow.

assert_eq!(<Ten as Minus<Three>>::Result::eval(), 7);
assert_eq!(<Seven as Minus<One>>::Result::eval(), 6);
assert_eq!(<Three as Minus<Three>>::Result::eval(), 0);
assert_eq!(<Two as Minus<Three>>::Result::eval(), 0);

Required Associated Types§

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

impl<T: Nat, U, V> Minus<Succ<T>> for U
where U: Minus<T, Result = V> + Nat, V: Pred + Nat,

Source§

type Result = <V as Pred>::Result

Source§

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