“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.”
The Rust Programming Language
Rust 官方入门教程,从所有权讲到并发与错误处理
Rust 官方文档团队写的标准教程,由 Steve Klabnik、Carol Nichols、Chris Krycho 执笔,从安装和基本语法讲起,重点放在所有权、借用、生命周期、trait、错误处理等 Rust 独有的概念上。全书按章节循序渐进,配有可运行的示例代码和小项目。和只讲语法的速查文档相比,它更注重解释为什么 Rust 要这样设计。
HN 上从 2015 年起就一直有人把它当作学 Rust 的首选,尤其用来解释所有权、借用、trait 和错误处理;有人说它值得读,哪怕不写 Rust 也能学到东西。早期有批评说教程过于乐观、对难点带过太快,错误处理部分也有点让人吃不消。
想系统学 Rust、已有一些编程经验的人
怎么读
由 Claude 根据这本书和 HN 上的说法整理,可能有错- 1先顺序读完所有权、借用和生命周期相关的章节,这是 Rust 最难的部分
- 2每章的示例代码都自己敲一遍,让编译器报错并读懂错误信息
- 3错误处理和 trait 部分遇到困难时,回头对照示例再读一遍
- 4读完后做一个小项目,再按需查阅标准库文档
HN 书评
推荐在前,同类按时间 · 每本最多保留 20 条,统计用全部提及 · 作者本人贴的不算“I found the rust-lang guide (now the rust-lang book[1]) very useful when first learning rust.”
“For more information on that, check out "trait objects".”
“In common, many basic things for Rust have very good descriptions in Rust Book. Please, pay attension on it and be more careful.”
“There is the Rust book The Rust Programming Language, which explains the basics of the language and the standard library though code snippets”
“For an introduction to traits in Rust, take a look at the book: The Rust Programming Language”
看全部 20 条 →
“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 (e.g. starting with the book[1]) will also teach you about RAII, generics, polymorphism, and ownership and move semantics”
“If you're curious, I'd recommend flipping through the syntax guide, there are a lot of well designed concepts:”
“For introduction to how Rust's ownership/borrowing/lifetimes system works, see the three chapters starting here: The Rust Programming Language”
“More about transfer of ownership at The Rust Programming Language”
“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 has one of the best programming language documentations I have ever had the pleasure of reading [1].”
“Though I knew how to use them, I didn't understand how Rust closures could work until I read these articles:”
“You're explicitly rejecting the most useful documentation there is.”
“these two sections from the book may help understad this”
“I really like the section of "Thinking in Scopes" in the Book that describes this:”
“The current tutorial is relentlessly upbeat and glosses over too many of the hard problems.”
“Look at this shit: The Rust Programming Language (open the menu at top-left) - Guessing Game! The Dining Philosophers!”
“I think the documentation is a little overwhelming when it comes to error checking and introduces non-essential craziness without warning.”