• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

build/H03-May-2022-1,041877

src/H03-May-2022-4,5813,208

tests/H03-May-2022-32

.cargo-checksum.jsonH A D03-May-202289 11

.cargo_vcs_info.jsonH A D01-Jan-197074 65

.gitignoreH A D26-Aug-201928 64

.travis.ymlH A D26-Aug-20192.3 KiB4539

CHANGELOG.mdH A D26-Aug-20193.1 KiB7758

Cargo.tomlH A D01-Jan-19701.1 KiB3228

Cargo.toml.orig-cargoH A D26-Aug-2019687 2320

LICENSEH A D26-Aug-20191.1 KiB2217

README.mdH A D26-Aug-20191.5 KiB4328

clippy.tomlH A D26-Aug-201934 21

README.md

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)
3
4Typenum
5=====
6
7Typenum is a Rust library for type-level numbers evaluated at compile time. It currently
8supports bits, unsigned integers, and signed integers.
9
10Typenum depends only on libcore, and so is suitable for use on any platform!
11
12For the full documentation, go [here](https://docs.rs/typenum).
13
14### Importing
15
16While `typenum` is divided into several modules, they are all re-exported through the crate root,
17so you can import anything contained herein with `use typenum::whatever;`, ignoring the
18crate structure.
19
20You may also find it useful to treat the `consts` module as a prelude, perfoming a glob import.
21
22### Example
23
24Here is a trivial example of `typenum`'s use:
25
26```rust
27use typenum::{Sum, Exp, Integer, N2, P3, P4};
28
29type X = Sum<P3, P4>;
30assert_eq!(<X as Integer>::to_i32(), 7);
31
32type Y = Exp<N2, P3>;
33assert_eq!(<Y as Integer>::to_i32(), -8);
34```
35
36For a non-trivial example of its use, see one of the crates that depends on it. The full
37list is [here](https://crates.io/crates/typenum/reverse_dependencies). Of note are
38[dimensioned](https://crates.io/crates/dimensioned/) which does compile-time type
39checking for arbitrary unit systems and
40[generic-array](https://crates.io/crates/generic-array/) which provides arrays whose
41length you can generically refer to.
42
43