typenum 1.0.1

Typenum is a Rust library for type-level numbers evaluated at compile time. It currently supports bits, unsigned integers, and signed integers.

crates.io Build Status

Typenum

Typenum is a Rust library for type-level numbers evaluated at compile time. It currently supports bits, unsigned integers, and signed integers.

For the full documentation, go here.

Here is a short example of its use:

use std::ops::Add;
use typenum::consts::{N2, P3, P4};
use typenum::int::Integer;
use typenum::Pow;

type X = <P3 as Add<P4>>::Output;
assert_eq!(<X as Integer>::to_i32(), 7);

type Y = <N2 as Pow<P3>>::Output;
assert_eq!(<Y as Integer>::to_i32(), -8);