mirror of
https://github.com/KaiserY/trpl-zh-cn
synced 2025-02-22 20:22:18 +08:00
Update ch03-02-data-types.md
This commit is contained in:
parent
6fc6645ae1
commit
17f68a22e6
@ -58,11 +58,11 @@ error[E0282]: type annotations needed
|
||||
|
||||
| 数字字面值 | 例子 |
|
||||
|------------------|---------------|
|
||||
| Decimal | `98_222` |
|
||||
| Hex | `0xff` |
|
||||
| Octal | `0o77` |
|
||||
| Binary | `0b1111_0000` |
|
||||
| Byte (`u8` only) | `b'A'` |
|
||||
| Decimal (十进制) | `98_222` |
|
||||
| Hex (十六进制) | `0xff` |
|
||||
| Octal (八进制) | `0o77` |
|
||||
| Binary (二进制) | `0b1111_0000` |
|
||||
| Byte (单字节字符)(仅限于`u8`) | `b'A'` |
|
||||
|
||||
那么该使用哪种类型的数字呢?如果拿不定主意,Rust 的默认类型通常就很好,数字类型默认是 `i32`:它通常是最快的,甚至在 64 位系统上也是。`isize` 或 `usize` 主要作为某些集合的索引。
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user