Module typenum::uint [] [src]

Type-level unsigned integers.

Type operators* implemented:

From std::ops: BitAnd, BitOr, BitXor, Shl, Shr, Add, Sub, Mul, Div, and Rem. From typenum: Same, Cmp, and Pow.

Rather than directly using the structs defined in this module, it is recommended that you import and use the relevant aliases from the consts module.

Example

use std::ops::{BitAnd, BitOr, BitXor, Shl, Shr, Add, Sub, Mul, Div, Rem};
use typenum::consts::{U1, U2, U3, U4};
use typenum::uint::Unsigned;

assert_eq!(<U3 as BitAnd<U2>>::Output::to_u32(), 2);
assert_eq!(<U3 as BitOr<U4>>::Output::to_u32(), 7);
assert_eq!(<U3 as BitXor<U2>>::Output::to_u32(), 1);
assert_eq!(<U3 as Shl<U1>>::Output::to_u32(), 6);
assert_eq!(<U3 as Shr<U1>>::Output::to_u32(), 1);
assert_eq!(<U3 as Add<U2>>::Output::to_u32(), 5);
assert_eq!(<U3 as Sub<U2>>::Output::to_u32(), 1);
assert_eq!(<U3 as Mul<U2>>::Output::to_u32(), 6);
assert_eq!(<U3 as Div<U2>>::Output::to_u32(), 1);
assert_eq!(<U3 as Rem<U2>>::Output::to_u32(), 1);

Structs

UInt

Enums

UTerm

Traits

Unsigned

The marker trait for compile time unsigned integers.