按年被提到
20192019 · 8 次2026
开源书›编程语言·No.87·简称 Async Book

Asynchronous Programming in Rust

Rust 异步编程
Rust Async Working Group

Rust 官方异步工作组的 async/await 指南,讲 Future 与 Pin

免费阅读 ↗
被推荐 · 32 人首次 2019-01-22 · 最近 2026-05-05许可证 MIT
32不同的人
25活跃月份
5有推荐的月份
29讨论串

Asynchronous Programming in Rust 由 Rust 异步工作组维护,是 Rust 官方的 async/await 指南,讲解 Future、执行器、Pin、Stream 以及异步代码的组织方式。书以解释概念为主,配有示例,帮助理解 Rust 的异步模型和其他语言的差别。它不是 Rust 入门书,更适合已学过 Rust 基础的人;部分章节仍不完整,需要和 tokio 等运行时文档配合。

HN 为什么推荐它

HN 上的人常引用它来解释 Rust 的 async 为什么存在、Pin 是什么、Future 是惰性的这些要点,也用来区分 reactor 和 runtime。同时有评论指出它不够完整,不同执行器之间难以互通这类问题书里没说透。

难度 4 / 5约 12 小时开放许可
适合谁

已掌握 Rust 基础、想写异步代码的开发者

读之前最好知道
1Rust 所有权(ownership)与生命周期
2线程与并发基础

怎么读

由 Claude 根据这本书和 HN 上的说法整理,可能有错
  1. 1先读为什么要 async 的部分,建立整体印象
  2. 2Pin 一章不好懂,可先看后面再回头读
  3. 3配合 tokio 或其他运行时的文档一起读
  4. 4自己动手写一个小型异步服务来练手

HN 书评

推荐在前,同类按时间 · 每本最多保留 20 条,统计用全部提及 · 作者本人贴的不算
推荐gatherhunterer · 2019-11

“Rust does a great job of documenting its features so these questions are usually already answered.”

称 Rust 文档做得好,用它解释 Rust 为何有 async
Rust async/await hits stable tomorrow原评论 ↗
推荐kodablah · 2019-11

“The tokio alpha docs and the async book[0] has some info, but both are a bit incomplete.”

指出 async book 有些信息,但内容不完整
Async-await on stable Rust原评论 ↗
推荐twodave · 2019-11

“For more on how async in Rust works, I'd invite you to read the actual manual on the subject (linked from the announcement): Asynchronous Programming in Rust”

建议读这本官方手册了解 Rust async 如何工作
Async-await on stable Rust原评论 ↗
推荐qppo · 2020-11

“But if you are curious, this chapter explains it pretty good:”

推荐这一章,把 pinning 讲得清楚
Why Dark didn't choose Rust原评论 ↗
推荐bennyz · 2021-02

“There are also some resources that are still incomplete, like the async book”

把它列为仍不完整的资源,与学地道 Rust 互补
Ask HN: Resources for Learning Idiomatic Rust?原评论 ↗
推荐hot_gril · 2023-07

“So I would still start at Asynchronous Programming in Rust”

建议从它入手,理解 async 为何存在
How to think about `async`/`await` in Rust原评论 ↗
看全部 20 条 →
推荐zesterer · 2024-10

“[This page] gives some nice details about the difference”

推荐这一页,里面细讲了 reactor 与 runtime 的区别
Code Generation in Rust vs. C++26原评论 ↗
引用shadowmint · 2019-01

“Is missing, somewhat ironic?”

质疑它缺了某些内容,觉得有些讽刺
Asynchronous Programming in Rust book原评论 ↗
引用arve0 · 2019-01

“(What is Pin? ref Asynchronous Programming in Rust)”

引用它解释 Pin 是什么
Asynchronous Programming in Rust book原评论 ↗
引用shaded-enmity · 2019-07

“Visiting Asynchronous Programming in Rust I don't see any mentions of neither C# nor JS.”

指出它没有提到 C# 和 JS
Why Generics?原评论 ↗
引用trevyn · 2020-04

“Async/await in Rust compiles down to a state machine (and to my understanding, uses generators under the hood):”

说明 Rust 的 async/await 编译成状态机
State Machines in Rust原评论 ↗
引用dap · 2020-07

“Even the async book[1] says:”

引用 async book 里的一句话
Choosing a Rust web framework原评论 ↗
引用cft · 2020-07

“I took an example of a server straight from the Rust async book, and to my surprise, it performed very well for a long time serving real internet requests”

说按它的示例写的服务器在真实请求下表现很好
Rust Is Surprisingly Good as a Server Language原评论 ↗
引用boulos · 2020-12

“The rust async/.await primer [2] offers the reader the seemingly helpful futures::executor::block_on, but basically no two executors can interact”

指出它推荐的 block_on 看似有用,但不同 executor 基本无法互通
Tokio 1.0 – async runtime for Rust原评论 ↗
引用scoutt · 2021-02

“("Futures are inert in Rust and make progress only when polled"[1])”

引用它说明 Rust 中 Future 是惰性的,被 poll 才推进
Comparison of Rust async and Linux thread context switch time and memory use原评论 ↗
引用wahern · 2021-08

“For example, recursive functions require dynamic allocation in an async context because the async state must be statically sized. See Asynchronous Programming in Rust”

引用它说明异步中递归函数需要动态分配
Async Overloading原评论 ↗
引用pjmlp · 2021-09

“Currently in Rust async/await generators discussion has been put on hold as being a hot topic”

提到 Rust 中 async/await generators 的讨论已被搁置
Golang: How to Update APIs for Generics原评论 ↗
引用Zababa · 2021-12

“In the async book from Rust [1]:”

引用 Rust async book 里的一段
Generics facilitators in Go原评论 ↗
引用duped · 2022-05

“Rust uses async/await based concurrency: Asynchronous Programming in Rust”

引用它说明 Rust 的并发基于 async/await
Ask HN: Goroutines in Rust?原评论 ↗
引用foldr · 2022-06

“See for example the discussion of stack pinning here: Asynchronous Programming in Rust”

引用其中对 stack pinning 的讨论作为例子
The Vale Programming Language原评论 ↗