Module uint
Type-level unsigned integers.
Type operators implemented:
From ::core::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 ;
use ;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
Structs
-
UInt
UIntis defined recursively, whereBis the least significant bit andUis the rest of the number. Conceptually,Ushould be bound by the traitUnsignedandBshould be bound by the traitBit, but enforcing these bounds causes linear instead of logrithmic scaling in some places, so they are left off for now. They may be enforced in future. -
UTerm
The terminating type for
UInt; it always comes after the most significant bit.UTermby itself represents zero, which is aliased toU0.
Traits
- GetBit
- PowerOfTwo The marker trait for type-level numbers which are a power of two.
-
SetBit
A type operator that, when implemented for unsigned integer
N, sets the bit at positionItoB. - Unsigned The marker trait for compile time unsigned integers.