boundnum 0.1.1

Bounded number type.
Documentation

Workflow Status

boundnum

This crate provides a type boundary and a numeric type bounded by it.

Example

use boundnum::{expr::*, typenum::consts::*, Bounded, Boundable};

fn main() {
    let less4 = Bounded::<u8, Le<Arg, U4>>::new::<U1>();

    let mul_of_two: Bounded<u8, Eq<U0, Rem<Arg, U2>>> =
        (*less4 + 3).bound().unwrap_or(Bounded::new::<U0>());
}