按年被提到
20152022 · 59 次2026
开源书›编程语言·No.9·简称 TRPL

The Rust Programming Language

Rust 程序设计语言
Steve Klabnik, Carol Nichols, Chris Krycho

Rust 官方入门教程,从所有权讲到并发与错误处理

免费阅读 ↗
被推荐 · 411 人首次 2015-01-09 · 最近 2026-10-16许可证 Apache 2.0 / MIT
411不同的人
133活跃月份
75有推荐的月份
447讨论串

Rust 官方文档团队写的标准教程,由 Steve Klabnik、Carol Nichols、Chris Krycho 执笔,从安装和基本语法讲起,重点放在所有权、借用、生命周期、trait、错误处理等 Rust 独有的概念上。全书按章节循序渐进,配有可运行的示例代码和小项目。和只讲语法的速查文档相比,它更注重解释为什么 Rust 要这样设计。

HN 为什么推荐它

HN 上从 2015 年起就一直有人把它当作学 Rust 的首选,尤其用来解释所有权、借用、trait 和错误处理;有人说它值得读,哪怕不写 Rust 也能学到东西。早期有批评说教程过于乐观、对难点带过太快,错误处理部分也有点让人吃不消。

难度 3 / 5约 40 小时开放许可
适合谁

想系统学 Rust、已有一些编程经验的人

读之前最好知道
1任意一门编程语言基础
2命令行基本操作
3指针与内存的基本概念

怎么读

由 Claude 根据这本书和 HN 上的说法整理,可能有错
  1. 1先顺序读完所有权、借用和生命周期相关的章节,这是 Rust 最难的部分
  2. 2每章的示例代码都自己敲一遍,让编译器报错并读懂错误信息
  3. 3错误处理和 trait 部分遇到困难时,回头对照示例再读一遍
  4. 4读完后做一个小项目,再按需查阅标准库文档

HN 书评

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

“The Rust book [The Rust Programming Language is by far the best resource to break into rust and get yourself started with a good foundation.”

强烈推荐,认为是入门 Rust 打牢基础的最佳资源
Ask HN: Best resources to learn and break into Rust?原评论 ↗
推荐jonalmeida · 2015-01

“I found the rust-lang guide (now the rust-lang book[1]) very useful when first learning rust.”

初学 Rust 时觉得它非常有用,讲了所有权
Explore the ownership system in Rust原评论 ↗
推荐masklinn · 2015-06

“For more information on that, check out "trait objects".”

指向它了解 trait objects
A year with Go原评论 ↗
推荐xilec · 2015-06

“In common, many basic things for Rust have very good descriptions in Rust Book. Please, pay attension on it and be more careful.”

称 Rust Book 把基础概念讲得很好,劝对方细读
Rust-Compare: a comparison of Rust, C++, and Java原评论 ↗
推荐Maken · 2015-09

“There is the Rust book The Rust Programming Language, which explains the basics of the language and the standard library though code snippets”

推荐,通过代码片段讲解 Rust 基础和标准库
Why Rust? [pdf]原评论 ↗
推荐lambda · 2015-10

“For an introduction to traits in Rust, take a look at the book: The Rust Programming Language”

指向它作为 Rust trait 的入门介绍
Rust-Doom: A Doom renderer in Rust, with no unsafe code原评论 ↗
看全部 20 条 →
推荐untothebreach · 2015-12

“If you decide to learn Rust, the Book[1] is, I think, the best way for you get started, seeing as you already have experience programming.”

认为有编程经验的人学 Rust 最好从它入手
Ask HN: C, C++, or Rust which language to learn next?原评论 ↗
推荐dbaupp · 2015-12

“Rust (e.g. starting with the book[1]) will also teach you about RAII, generics, polymorphism, and ownership and move semantics”

说从它学 Rust 还能学到 RAII、泛型、所有权和 move
Ask HN: C, C++, or Rust which language to learn next?原评论 ↗
推荐emcq · 2016-03

“If you're curious, I'd recommend flipping through the syntax guide, there are a lot of well designed concepts:”

建议翻翻语法指南,里面有很多设计良好的概念
Ill-Advised C++ Rant, Part 2原评论 ↗
推荐ekidd · 2016-06

“For introduction to how Rust's ownership/borrowing/lifetimes system works, see the three chapters starting here: The Rust Programming Language”

指向它的三章,讲所有权、借用和生命周期
Lambda crabs, part 1: A mathematical introduction to lifetimes and regions原评论 ↗
推荐pmontra · 2016-09

“More about transfer of ownership at The Rust Programming Language”

指向它了解更多所有权转移
Proposal of a new concurrency model for Ruby 3 [pdf]原评论 ↗
推荐vvanders · 2016-11

“The Rust Programming Language goes into it in great depth. It's a fair bit to grok but really shows how thorough the options Rust has when dealing with errors.”

推荐它深入讲 Rust 错误处理,难啃但体现选项之全
Announcing Rust 1.13原评论 ↗
推荐htaunay · 2016-12

“Rust has one of the best programming language documentations I have ever had the pleasure of reading [1].”

称 Rust 文档是读过的最好的之一
Rust vs C Pitfalls原评论 ↗
推荐ucarion · 2016-12

“Though I knew how to use them, I didn't understand how Rust closures could work until I read these articles:”

读了这些文章才明白 Rust 闭包如何工作
Rust is more than safety原评论 ↗
推荐eridius · 2017-01

“You're explicitly rejecting the most useful documentation there is.”

指出拒绝它就是拒绝最有用的文档
Rust severely disappoints me原评论 ↗
推荐lordnaikon · 2017-01

“these two sections from the book may help understad this”

指出书中这两节有助于理解 move
Rust vs. Go原评论 ↗
推荐bluejekyll · 2017-08

“I really like the section of "Thinking in Scopes" in the Book that describes this:”

喜欢书中“Thinking in Scopes”一节对这点的讲解
Rust RFC 2094: non-lexical lifetimes原评论 ↗
批评Animats · 2015-02

“The current tutorial is relentlessly upbeat and glosses over too many of the hard problems.”

批评教程一味乐观,对很多难题一笔带过
Some notes on Rust原评论 ↗
批评logicallee · 2015-07

“Look at this shit: The Rust Programming Language (open the menu at top-left) - Guessing Game! The Dining Philosophers!”

批评目录里放猜数游戏、哲学家就餐这类章节
Ask HN: Do you get impatient when learning new things?原评论 ↗
批评papaf · 2016-11

“I think the documentation is a little overwhelming when it comes to error checking and introduces non-essential craziness without warning.”

批评文档在错误检查部分过于繁杂,还无预警引入非必要内容
2016 Rust Commercial User Survey Results原评论 ↗