Module typenum::consts

source ·
Expand description

Type aliases for many constants.

This file is generated by typenum’s build script.

For unsigned integers, the format is U followed by the number. We define aliases for

  • Numbers 0 through 1024
  • Powers of 2 below u64::MAX
  • Powers of 10 below u64::MAX

These alias definitions look like this:

use typenum::{B0, B1, UInt, UTerm};

type U6 = UInt<UInt<UInt<UTerm, B1>, B1>, B0>;

For positive signed integers, the format is P followed by the number and for negative signed integers it is N followed by the number. For the signed integer zero, we use Z0. We define aliases for

  • Numbers -1024 through 1024
  • Powers of 2 between i64::MIN and i64::MAX
  • Powers of 10 between i64::MIN and i64::MAX

These alias definitions look like this:

use typenum::{B0, B1, UInt, UTerm, PInt, NInt};

type P6 = PInt<UInt<UInt<UInt<UTerm, B1>, B1>, B0>>;
type N6 = NInt<UInt<UInt<UInt<UTerm, B1>, B1>, B0>>;

Example

use typenum::{U0, U1, U2, U3, U4, U5, U6};
use typenum::{N3, N2, N1, Z0, P1, P2, P3};
use typenum::{U774, N17, N10000, P1024, P4096};

We also define the aliases False and True for B0 and B1, respectively.

Re-exports

pub use crate::bit::B0;
pub use crate::bit::B1;
pub use crate::int::Z0;

Type Definitions