# type-nats.rs Type-level natural numbers in Rust [![build status](https://api.travis-ci.org/darinmorrison/type-nats.rs.svg?branch=master)](https://travis-ci.org/darinmorrison/type-nats.rs) ## Synopsis This library implements type-level natural numbers using traits and associated types. At this stage it is meant to serve as a demonstration more than anything else. ## Examples ```rust fn example() { let _: SNat< S>>>> > = Add::< S>> , S> >::query(); let _: SNat< N06 > = Mul::< N03 , N02 >::query(); let _: SNat< N08 > = Exp::< N03 , N02 >::query(); let _: SNat< N24 > = Fac::< N04 >::query(); assert_eq!(Add::< N03 , N02 >::to_uint(), 5u); assert_eq!(Mul::< N03 , N02 >::to_uint(), 6u); assert_eq!(Exp::< N03 , N02 >::to_uint(), 8u); assert_eq!(Fac::< N04 >::to_uint(), 24u); } ``` ## Documentation See the API documentation [here](http://darinmorrison.github.io/type-nats.rs/doc/type-nats/). ## Requirements 1. [Rust](http://www.rust-lang.org/) 2. [Cargo](http://crates.io/) You can install both with the following: ``` $ curl -s https://static.rust-lang.org/rustup.sh | sudo sh ``` See [Installing Rust](http://doc.rust-lang.org/guide.html#installing-rust) for further details. ## Usage ``` $ cargo build ## build library and binary $ cargo test ## run tests in ./tests $ cargo bench ## run benchmarks in ./benches ``` ## Discussion There is an IRC channel on [freenode](https://freenode.net) (chat.freenode.net) at [#epsilonz](http://webchat.freenode.net/?channels=%23epsilonz).