This story was originally published on Medium
Unsigned Integer Types
Unsigned integer types in Rust start with
u and it has 8, 16, 32, 64, and 128-bit. The minimum and maximum values are from 0 to 2ⁿ-1.
u8 has 0 to 2⁸-1, which is 255. The following table shows all the details for unsigned integers.
If you try to assign a negative number to an unsigned type, it will fail.
- is one of Rust's unary operators and it is the negation operator for signed integer types and floating-point types.