3.1 Primitives
| Type | Size | Note |
|---|---|---|
i8 i16 i32 i64 i128 | 1–16 bytes | two's complement |
u8 u16 u32 u64 u128 | 1–16 bytes | |
isize usize | pointer size | indices and lengths are usize |
f32 f64 | 4, 8 bytes | IEEE 754 |
bool | 1 byte | |
char | 4 bytes | Unicode scalar value |
() | 0 | unit, the only value is () |
never | 0 | the type of expressions that do not return control: fail, return, panic, an infinite loop |
Integer arithmetic. + - * check for overflow in all build profiles; overflow is a panic. Explicit variants: +% -% *% — wrapping, +| -| *| — saturating, methods such as checked_add return T?. Division by zero and a shift by the type width or more are a panic.
Conversion. x as T for numbers: widening always succeeds; narrowing and sign conversion panic when out of range; f → int panics on NaN and when out of range. x.wrap<T>() — wrapping, x.try<T>() — T | OutOfRange.
See also
Source: docs/spec/oxl-standard.en.md