From ea0b8916b4e7419da84c40c2c2a50f930356157c Mon Sep 17 00:00:00 2001 From: qwer252 Date: Tue, 10 Jun 2025 20:03:43 +0800 Subject: [PATCH 1/6] Update ch17-05-traits-for-async.md --- src/ch17-05-traits-for-async.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ch17-05-traits-for-async.md b/src/ch17-05-traits-for-async.md index 51ddd81..1d6d1c5 100644 --- a/src/ch17-05-traits-for-async.md +++ b/src/ch17-05-traits-for-async.md @@ -44,7 +44,7 @@ match page_title(url).poll() { None => println!("{url} had no title"), } Pending => { - // But what goes here? + // 但这里运行什么呢? } } ``` From 41c73fa626733e01c016706963b5b728e0dae633 Mon Sep 17 00:00:00 2001 From: qwer252 Date: Tue, 10 Jun 2025 20:12:27 +0800 Subject: [PATCH 2/6] Update ch17-05-traits-for-async.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 有个小语病 --- src/ch17-05-traits-for-async.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ch17-05-traits-for-async.md b/src/ch17-05-traits-for-async.md index 1d6d1c5..5564d39 100644 --- a/src/ch17-05-traits-for-async.md +++ b/src/ch17-05-traits-for-async.md @@ -197,7 +197,7 @@ pub trait Future { -因此,如果 `String` 实现了 `!Unpin` 我们可以做一些非法的事,比如像图 17-9 这样在完全相同的内存位置将一个字符串替换为另一个字符串。这并不违反 `Pin` 的规则,因为 `String` 没有内部引用这使得它可以安全地移动!这是为何它实现了 `Unpin` 而不是 `!Unpin` 的原因。 +因此,如果 `String` 实现了 `!Unpin` 我们可以做一些非法的事,比如像图 17-9 这样在完全相同的内存位置将一个字符串替换为另一个字符串。这并不违反 `Pin` 的规则,因为 `String` 没有内部引用这使得它可以安全地移动!这是为何它实现了 `Unpin` 而不是 `!Unpin`。
From 90d44058131f623330294ca509c0f06c7d0a5841 Mon Sep 17 00:00:00 2001 From: qwer252 Date: Tue, 10 Jun 2025 23:55:17 +0800 Subject: [PATCH 3/6] Update main.rs --- listings/ch17-async-await/listing-17-41/src/main.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/listings/ch17-async-await/listing-17-41/src/main.rs b/listings/ch17-async-await/listing-17-41/src/main.rs index f1f3d4b..edf8445 100644 --- a/listings/ch17-async-await/listing-17-41/src/main.rs +++ b/listings/ch17-async-await/listing-17-41/src/main.rs @@ -47,11 +47,11 @@ fn get_messages() -> impl Stream { fn get_intervals() -> impl Stream { let (tx, rx) = trpl::channel(); - // This is *not* `trpl::spawn` but `std::thread::spawn`! + // 这里*不是* `trpl::spawn` ,是 `std::thread::spawn`! thread::spawn(move || { let mut count = 0; loop { - // Likewise, this is *not* `trpl::sleep` but `std::thread::sleep`! + // 同样, 这里*不是* `trpl::sleep` ,是 `std::thread::sleep`! thread::sleep(Duration::from_millis(1)); count += 1; From ed9c777af8dd36f56b02f1b1e1d585a354a9c4a8 Mon Sep 17 00:00:00 2001 From: qwer252 Date: Tue, 10 Jun 2025 23:57:31 +0800 Subject: [PATCH 4/6] Update main.rs --- listings/ch17-async-await/listing-17-41/src/main.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/listings/ch17-async-await/listing-17-41/src/main.rs b/listings/ch17-async-await/listing-17-41/src/main.rs index edf8445..f999dfa 100644 --- a/listings/ch17-async-await/listing-17-41/src/main.rs +++ b/listings/ch17-async-await/listing-17-41/src/main.rs @@ -47,11 +47,11 @@ fn get_messages() -> impl Stream { fn get_intervals() -> impl Stream { let (tx, rx) = trpl::channel(); - // 这里*不是* `trpl::spawn` ,是 `std::thread::spawn`! + // 这里 *不是* `trpl::spawn` ,是 `std::thread::spawn`! thread::spawn(move || { let mut count = 0; loop { - // 同样, 这里*不是* `trpl::sleep` ,是 `std::thread::sleep`! + // 同样, 这里 *不是* `trpl::sleep` ,是 `std::thread::sleep`! thread::sleep(Duration::from_millis(1)); count += 1; From a621cdf1cb12826616a76c13099af192c0e9cc39 Mon Sep 17 00:00:00 2001 From: qwer252 Date: Wed, 11 Jun 2025 00:07:15 +0800 Subject: [PATCH 5/6] Update main.rs --- listings/ch17-async-await/listing-17-41/src/main.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/listings/ch17-async-await/listing-17-41/src/main.rs b/listings/ch17-async-await/listing-17-41/src/main.rs index f999dfa..bd6677d 100644 --- a/listings/ch17-async-await/listing-17-41/src/main.rs +++ b/listings/ch17-async-await/listing-17-41/src/main.rs @@ -47,11 +47,11 @@ fn get_messages() -> impl Stream { fn get_intervals() -> impl Stream { let (tx, rx) = trpl::channel(); - // 这里 *不是* `trpl::spawn` ,是 `std::thread::spawn`! + // 这里 *不是* `trpl::spawn` ,是 `std::thread::spawn`! thread::spawn(move || { let mut count = 0; loop { - // 同样, 这里 *不是* `trpl::sleep` ,是 `std::thread::sleep`! + // 同样,这里 *不是* `trpl::sleep` ,是 `std::thread::sleep`! thread::sleep(Duration::from_millis(1)); count += 1; From 2803bd07249d3dac9d491acb1893d896b40be8b2 Mon Sep 17 00:00:00 2001 From: qwer252 Date: Wed, 11 Jun 2025 00:08:41 +0800 Subject: [PATCH 6/6] Update main.rs --- listings/ch17-async-await/listing-17-41/src/main.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/listings/ch17-async-await/listing-17-41/src/main.rs b/listings/ch17-async-await/listing-17-41/src/main.rs index bd6677d..7cdab2c 100644 --- a/listings/ch17-async-await/listing-17-41/src/main.rs +++ b/listings/ch17-async-await/listing-17-41/src/main.rs @@ -47,11 +47,11 @@ fn get_messages() -> impl Stream { fn get_intervals() -> impl Stream { let (tx, rx) = trpl::channel(); - // 这里 *不是* `trpl::spawn` ,是 `std::thread::spawn`! + // 这里 *不是* `trpl::spawn`,是 `std::thread::spawn`! thread::spawn(move || { let mut count = 0; loop { - // 同样,这里 *不是* `trpl::sleep` ,是 `std::thread::sleep`! + // 同样,这里 *不是* `trpl::sleep`,是 `std::thread::sleep`! thread::sleep(Duration::from_millis(1)); count += 1;