1 [![crates.io](https://img.shields.io/crates/v/typenum.svg)](https://crates.io/crates/typenum)
2 [![Build Status](https://travis-ci.org/paholg/typenum.svg?branch=master)](https://travis-ci.org/paholg/typenum)
7 Typenum is a Rust library for type-level numbers evaluated at compile time. It currently
8 supports bits, unsigned integers, and signed integers.
10 Typenum depends only on libcore, and so is suitable for use on any platform!
12 For the full documentation, go [here](https://docs.rs/typenum).
16 While `typenum` is divided into several modules, they are all re-exported through the crate root,
17 so you can import anything contained herein with `use typenum::whatever;`, ignoring the
20 You may also find it useful to treat the `consts` module as a prelude, perfoming a glob import.
24 Here is a trivial example of `typenum`'s use:
27 use typenum::{Sum, Exp, Integer, N2, P3, P4};
30 assert_eq!(<X as Integer>::to_i32(), 7);
33 assert_eq!(<Y as Integer>::to_i32(), -8);
36 For a non-trivial example of its use, see one of the crates that depends on it. The full
37 list is [here](https://crates.io/crates/typenum/reverse_dependencies). Of note are
38 [dimensioned](https://crates.io/crates/dimensioned/) which does compile-time type
39 checking for arbitrary unit systems and
40 [generic-array](https://crates.io/crates/generic-array/) which provides arrays whose
41 length you can generically refer to.
46 Typenum's error messages aren't great, and can be difficult to parse. The good news is
47 that the fine folks at Auxon have written a tool to help with it. Please take a look at
48 [tnfilt](https://github.com/auxoncorp/tnfilt).