You've already forked comprehensive-rust
mirror of
https://github.com/google/comprehensive-rust.git
synced 2025-06-27 11:08:45 +02:00
Move to more legible types (#989)
* Move to more legible types * Add information about underscores
This commit is contained in:
@ -1,13 +1,13 @@
|
|||||||
# Scalar Types
|
# Scalar Types
|
||||||
|
|
||||||
| | Types | Literals |
|
| | Types | Literals |
|
||||||
|------------------------|--------------------------------------------|-------------------------------|
|
|------------------------|--------------------------------------------|--------------------------------|
|
||||||
| Signed integers | `i8`, `i16`, `i32`, `i64`, `i128`, `isize` | `-10`, `0`, `1_000`, `123i64` |
|
| Signed integers | `i8`, `i16`, `i32`, `i64`, `i128`, `isize` | `-10`, `0`, `1_000`, `123_i64` |
|
||||||
| Unsigned integers | `u8`, `u16`, `u32`, `u64`, `u128`, `usize` | `0`, `123`, `10u16` |
|
| Unsigned integers | `u8`, `u16`, `u32`, `u64`, `u128`, `usize` | `0`, `123`, `10_u16` |
|
||||||
| Floating point numbers | `f32`, `f64` | `3.14`, `-10.0e20`, `2f32` |
|
| Floating point numbers | `f32`, `f64` | `3.14`, `-10.0e20`, `2_f32` |
|
||||||
| Strings | `&str` | `"foo"`, `"two\nlines"` |
|
| Strings | `&str` | `"foo"`, `"two\nlines"` |
|
||||||
| Unicode scalar values | `char` | `'a'`, `'α'`, `'∞'` |
|
| Unicode scalar values | `char` | `'a'`, `'α'`, `'∞'` |
|
||||||
| Booleans | `bool` | `true`, `false` |
|
| Booleans | `bool` | `true`, `false` |
|
||||||
|
|
||||||
The types have widths as follows:
|
The types have widths as follows:
|
||||||
|
|
||||||
@ -40,4 +40,7 @@ There are a few syntaxes which are not shown above:
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
- All underscores in numbers can be left out, they are for legibility only.
|
||||||
|
So `1_000` can be written as `1000` (or `10_00`), and `123_i64` can be written as `123i64`.
|
||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
Reference in New Issue
Block a user