mirror of
https://github.com/gnu4cn/rust-lang-zh_CN.git
synced 2025-03-14 19:30:29 +08:00
Update Ch21
This commit is contained in:
parent
e231bafcf5
commit
905fc6b7bd
@ -36,7 +36,7 @@ fn main() {
|
||||
|
||||
|
||||
```console
|
||||
$ cargo run
|
||||
$ cargo run
|
||||
Compiling error_handling_demo v0.1.0 (/home/lenny/rust-lang/error_handling_demo)
|
||||
Finished dev [unoptimized + debuginfo] target(s) in 0.40s
|
||||
Running `target/debug/error_handling_demo`
|
||||
@ -229,7 +229,7 @@ fn main() {
|
||||
Err(e) => match e.kind() {
|
||||
ErrorKind::NotFound => match File::create("hello.txt") {
|
||||
Ok(fc) => fc,
|
||||
Err(error) => panic! ("创建该文件时出现问题:{:?}", error),
|
||||
Err(error) => panic! ("创建该文件时出现问题:{:?}", error),
|
||||
},
|
||||
other_error => panic! ("打开文件出现问题:{:?}", other_error),
|
||||
},
|
||||
|
@ -173,10 +173,10 @@ fn main() {
|
||||
| `@` | `ident @ pat` | 模式绑定 | |
|
||||
| `^` | `var ^ expr` | 按位异或运算 | `BitXor` |
|
||||
| `^=` | `var ^= expr` | 按位异或运算并赋值 | `BitXorAssign` |
|
||||
| `\|` | `pat | pat` | 模式选择,pattern alternatives | |
|
||||
| `\|` | `expr | expr` | 按位或运算 | `BitOr` |
|
||||
| `\|=` | `var |= expr` | 按位或运算并赋值 | `BitOrAssign` |
|
||||
| `\|\|` | `expr || expr` | 短路逻辑或运算 | |
|
||||
| <code>|</code> | <code>pat | pat</code> | 模式选择,pattern alternatives | |
|
||||
| <code>|</code> | <code>expr | expr</code> | 按位或运算 | `BitOr` |
|
||||
| <code>|=</code> | <code>var |= expr</code> | 按位或运算并赋值 | `BitOrAssign` |
|
||||
| <code>||</code> | <code>expr || expr</code> | 短路逻辑或运算 | |
|
||||
| `?` | `expr?` | 错误传递 | |
|
||||
|
||||
### 非运算符的符号
|
||||
|
Loading…
Reference in New Issue
Block a user