From d4f9f1aa1298668237821e480824ab5f7d8146d1 Mon Sep 17 00:00:00 2001 From: qwer252 Date: Thu, 12 Jun 2025 14:39:15 +0800 Subject: [PATCH 1/4] Update lib.rs --- listings/ch21-web-server/listing-21-13/src/lib.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/listings/ch21-web-server/listing-21-13/src/lib.rs b/listings/ch21-web-server/listing-21-13/src/lib.rs index 35960e7..ff5a579 100644 --- a/listings/ch21-web-server/listing-21-13/src/lib.rs +++ b/listings/ch21-web-server/listing-21-13/src/lib.rs @@ -2,13 +2,13 @@ pub struct ThreadPool; // ANCHOR: here impl ThreadPool { - /// Create a new ThreadPool. + /// 创建一个新的线程池。 /// - /// The size is the number of threads in the pool. + /// size 是池中线程的数量。 /// /// # Panics /// - /// The `new` function will panic if the size is zero. + /// 如果 size 为 0 ,`new` 方法会 panic。 pub fn new(size: usize) -> ThreadPool { assert!(size > 0); From ead81e11f75ac8a2ab03333815f3407230f75ec4 Mon Sep 17 00:00:00 2001 From: qwer252 Date: Thu, 12 Jun 2025 14:44:40 +0800 Subject: [PATCH 2/4] Update lib.rs --- listings/ch21-web-server/listing-21-14/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/listings/ch21-web-server/listing-21-14/src/lib.rs b/listings/ch21-web-server/listing-21-14/src/lib.rs index c1fa182..76dcdb0 100644 --- a/listings/ch21-web-server/listing-21-14/src/lib.rs +++ b/listings/ch21-web-server/listing-21-14/src/lib.rs @@ -22,7 +22,7 @@ impl ThreadPool { let mut threads = Vec::with_capacity(size); for _ in 0..size { - // create some threads and store them in the vector + // 创建一些线程并将它们存入 vector 中。 } ThreadPool { threads } From d618533000bfe5b1530b5b28198913cd5fb735be Mon Sep 17 00:00:00 2001 From: qwer252 Date: Thu, 12 Jun 2025 17:06:25 +0800 Subject: [PATCH 3/4] Update appendix-01-keywords.md --- src/appendix-01-keywords.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/appendix-01-keywords.md b/src/appendix-01-keywords.md index f21c335..c93a1a9 100644 --- a/src/appendix-01-keywords.md +++ b/src/appendix-01-keywords.md @@ -111,6 +111,6 @@ fn main() { 此代码编译没有任何错误。注意 `r#` 前缀需同时用于函数名定义和 `main` 函数中的调用。 -原始标识符允许使用你选择的任何单词作为标识符,即使该单词恰好是保留关键字。这给予了我们更大的自由来选择名字,这样与其他语言交互式就不用考虑到关键字问题,在要交互的语言中这个名字不是关键字。此外,原始标识符允许你使用以不同于你的 crate 使用的 Rust 版本编写的库。比如,`try` 在 2015 edition 中不是关键字,而在 2018、2021 和 2024 editio 则是。所以如果用 2015 edition 编写的库中带有 `try` 函数,在 2018 edition 中调用时就需要使用原始标识符语法,在这里是 `r#try`。有关版本的更多信息,请参见[附录 E][appendix-e]。 +原始标识符允许使用你选择的任何单词作为标识符,即使该单词恰好是保留关键字。这给予了我们更大的自由来选择名字,这样与其他语言交互式就不用考虑到关键字问题,在要交互的语言中这个名字不是关键字。此外,原始标识符允许你使用以不同于你的 crate 使用的 Rust 版本编写的库。比如,`try` 在 2015 edition 中不是关键字,而在 2018、2021 和 2024 edition 则是。所以如果用 2015 edition 编写的库中带有 `try` 函数,在 2018 edition 中调用时就需要使用原始标识符语法,在这里是 `r#try`。有关版本的更多信息,请参见[附录 E][appendix-e]。 [appendix-e]: appendix-05-editions.html From 7d556f310ddeb0944824995ad4637a8ff468a09b Mon Sep 17 00:00:00 2001 From: qwer252 Date: Thu, 12 Jun 2025 17:50:36 +0800 Subject: [PATCH 4/4] Update lib.rs --- listings/ch21-web-server/listing-21-13/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/listings/ch21-web-server/listing-21-13/src/lib.rs b/listings/ch21-web-server/listing-21-13/src/lib.rs index ff5a579..bfb96fe 100644 --- a/listings/ch21-web-server/listing-21-13/src/lib.rs +++ b/listings/ch21-web-server/listing-21-13/src/lib.rs @@ -8,7 +8,7 @@ impl ThreadPool { /// /// # Panics /// - /// 如果 size 为 0 ,`new` 方法会 panic。 + /// 如果 size 为 0,`new` 方法会 panic。 pub fn new(size: usize) -> ThreadPool { assert!(size > 0);