This crate provides type-level natural numbers, similar to typenum.
A type-level number is a type that represents a number. The Nat trait takes the role of the
“type-level number type”, i.e. one accepts a type-level number using a generic parameter with
bound Nat.
The use cases are the same as those of generic consts.
gnat differs from typenum in that its Nat trait is not a marker trait, but defines
enough (internal) structure to be able to define and use operations on it, generically.
This crate is to the unstable generic_const_expr feature what typenum is to the already
stable min_const_generics feature. For example, consider the case of concatenating arrays
at compile time
// Ideal function, requires #![feature(generic_const_expr)]
const
// typenum + generic-array implementation
use ;
const >
where // ArrayLength is not enough, we also need to add a bound for `+`
M: Add,
// gnat implementation
use ;
const >
It is also possible to implement custom operations without any extra bounds needed to use them.
See the mod@expr module.