From 9df391e2c30fbd20177026ce157fda6d3eacac3f Mon Sep 17 00:00:00 2001 From: HuberWong <85234311+HuberWong@users.noreply.github.com> Date: Wed, 9 Mar 2022 22:53:15 +0800 Subject: [PATCH 1/4] =?UTF-8?q?358=20=E8=A1=8C=E7=AC=AC=E4=BA=8C=E5=8F=A5?= =?UTF-8?q?=E7=9A=84=E2=80=9C=E4=B8=8B=E9=9D=A2=E2=80=9D=E4=B8=8E=E2=80=9C?= =?UTF-8?q?=E4=BB=AC=E2=80=9D=E4=B9=8B=E9=97=B4=E7=BC=BA=E5=B0=91=E2=80=9C?= =?UTF-8?q?=E6=88=91=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/advance/functional-programing/iterator.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/advance/functional-programing/iterator.md b/src/advance/functional-programing/iterator.md index 10d90de8..af8f0663 100644 --- a/src/advance/functional-programing/iterator.md +++ b/src/advance/functional-programing/iterator.md @@ -355,7 +355,7 @@ impl Counter { } ``` -我们为计数器 `Counter` 实现了一个关联函数 `new`,用于创建新的计数器实例。下面们继续为计数器实现 `Iterator` 特征: +我们为计数器 `Counter` 实现了一个关联函数 `new`,用于创建新的计数器实例。下面我们继续为计数器实现 `Iterator` 特征: ```rust impl Iterator for Counter { From f47198f7ddecfdf3752a45a087356afc093fc084 Mon Sep 17 00:00:00 2001 From: 1478zhcy <61115159+1478zhcy@users.noreply.github.com> Date: Thu, 10 Mar 2022 00:48:01 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E5=AF=B9=E4=BA=8Ematch=E4=B8=AD=E2=80=9C|?= =?UTF-8?q?=E2=80=9D=E6=9B=B4=E5=87=86=E7=A1=AE=E7=9A=84=E6=8F=8F=E8=BF=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/basic/match-pattern/match-if-let.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/basic/match-pattern/match-if-let.md b/src/basic/match-pattern/match-if-let.md index 1e95bbd9..78c91390 100644 --- a/src/basic/match-pattern/match-if-let.md +++ b/src/basic/match-pattern/match-if-let.md @@ -28,7 +28,7 @@ fn main() { - `match` 的匹配必须要穷举出所有可能,因此这里用 `_` 来代表未列出的所有可能性 - `match` 的每一个分支都必须是一个表达式,且所有分支的表达式最终返回值的类型必须相同 -- **X | Y**,是逻辑运算符 `或`,代表该分支可以匹配 `X` 也可以匹配 `Y`,只要满足一个即可 +- **X | Y**,类似逻辑运算符 `或`,代表该分支可以匹配 `X` 也可以匹配 `Y`,只要满足一个即可 其实 `match` 跟其他语言中的 `switch` 非常像,`_` 类似于 `switch` 中的 `default`。 @@ -366,4 +366,4 @@ fn main() { ## 课后练习 -> [Rust By Practice](https://zh.practice.rs/pattern-match/match-iflet.html),支持代码在线编辑和运行,并提供详细的[习题解答](https://github.com/sunface/rust-by-practice)。 \ No newline at end of file +> [Rust By Practice](https://zh.practice.rs/pattern-match/match-iflet.html),支持代码在线编辑和运行,并提供详细的[习题解答](https://github.com/sunface/rust-by-practice)。 From 2d865a8e89d4eeb8773cb8c0ebbd64dde917c1e4 Mon Sep 17 00:00:00 2001 From: Rustln Date: Thu, 10 Mar 2022 11:36:28 +0800 Subject: [PATCH 3/4] =?UTF-8?q?Fixed=20typo=20`=E8=AF=AD=E8=A8=80`=20to=20?= =?UTF-8?q?`=E8=AF=AD=E6=B3=95`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/basic/match-pattern/all-patterns.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/basic/match-pattern/all-patterns.md b/src/basic/match-pattern/all-patterns.md index 2d332ecc..64c5a080 100644 --- a/src/basic/match-pattern/all-patterns.md +++ b/src/basic/match-pattern/all-patterns.md @@ -64,7 +64,7 @@ match x { ### 通过序列 `..=` 匹配值的范围 -在[数值类型](https://course.rs/basic/base-type/numbers.html#序列range)中我们有讲到一个序列语法,该语言不仅可以用循环中,还能用于匹配模式。 +在[数值类型](https://course.rs/basic/base-type/numbers.html#序列range)中我们有讲到一个序列语法,该语法不仅可以用循环中,还能用于匹配模式。 `..=` 语法允许你匹配一个闭区间序列内的值。在如下代码中,当模式匹配任何在此序列内的值时,该分支会执行: @@ -613,4 +613,4 @@ num @ (1 | 2) ## 课后练习 -> [Rust By Practice](https://zh.practice.rs/pattern-match/patterns.html),支持代码在线编辑和运行,并提供详细的[习题解答](https://github.com/sunface/rust-by-practice)。 \ No newline at end of file +> [Rust By Practice](https://zh.practice.rs/pattern-match/patterns.html),支持代码在线编辑和运行,并提供详细的[习题解答](https://github.com/sunface/rust-by-practice)。 From c06a6e5d3e94b9c403304e646dd33c12341dd045 Mon Sep 17 00:00:00 2001 From: zongzi531 Date: Thu, 10 Mar 2022 13:43:04 +0800 Subject: [PATCH 4/4] Fix typo in concurrency-with-threads/thread.md --- src/advance/concurrency-with-threads/thread.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/advance/concurrency-with-threads/thread.md b/src/advance/concurrency-with-threads/thread.md index a57594fb..c58fed54 100644 --- a/src/advance/concurrency-with-threads/thread.md +++ b/src/advance/concurrency-with-threads/thread.md @@ -164,7 +164,7 @@ fn main() { 大家要记住,线程的启动时间点和结束时间点是不确定的,因此存在一种可能,当主线程执行完, `v` 被释放掉时,新的线程很可能还没有结束甚至还没有被创建成功,此时新线程对 `v` 的引用立刻就不再合法! -好在报错里进行了提示:`to force the closure to take ownership of v (and any other referenced variables), use the move keyword`,让我们使用 `move` 关键字拿走 `v` 的所有权即可: +好在报错里进行了提示:```to force the closure to take ownership of v (and any other referenced variables), use the `move` keyword```,让我们使用 `move` 关键字拿走 `v` 的所有权即可: ```rust use std::thread;