4 陷阱

陷阱 — Comprehensive Rust

译文 · 基于 Comprehensive Rust

原文链接: https://google.github.io/comprehensive-rust/concurrency/async-pitfalls.html

4 陷阱

Async / await 为并发异步编程提供了方便且高效的抽象。不过,Rust 的 async/await 模型也有其陷阱与易踩坑点。本章举例说明其中一些。

本小节约需 55 分钟。内容包括:

内容时长
阻塞执行器10 分钟
Pin20 分钟
异步 Trait5 分钟
取消20 分钟

4.1 阻塞执行器

01-阻塞执行器 — Comprehensive Rust

4.2 `Pin`

02-Pin — Comprehensive Rust

4.3 异步 Trait

03-异步 Trait — Comprehensive Rust

4.4 取消

04-取消 — Comprehensive Rust

最后修改 August 11, 2026: 更新 (70a5af133)