11.12 官方文档与权威资料索引
所属:全栈开发面试题库 / 学习路径 / 11 Rust 全栈
下表按阶段分组给出本篇用到的官方与权威资料。只收录官方源(doc.rust-lang.org、tokio.rs、tauri.app、rust-embedded.org 等),第三方博客与教程不列入。每条说明「什么时候读、读到什么程度」:阶段 0–2 把 The Rust Book 通读一遍;阶段 3 以后以查 API 为主,不需要整本啃完。
阶段 0:工具链与开发环境
| 名称 | 链接 | 什么时候读、读到什么程度 |
|---|---|---|
| rustup 官方站点 | https://rustup.rs/ | 第一次装工具链时读一遍命令与镜像源说明即可 |
| Cargo 官方手册(The Cargo Book) | https://doc.rust-lang.org/cargo/ | 阶段 0 通读「指南」章节;以后遇到 Cargo.toml/build script/feature 问题时回查 |
| crates.io 包仓库 | https://crates.io/ | 找第三方 crate 时查;以它的下载量与版本活跃度作为选型参考 |
| docs.rs | https://docs.rs/ | 所有 crate 的 API 文档统一入口,写代码时随时查 |
| The Rust Edition Guide | https://doc.rust-lang.org/edition-guide/ | 阶段 0 了解 2015/2018/2021/2024 的差异;迁移旧项目时逐章读 |
阶段 1–2:语言基础、所有权与生命周期
| 名称 | 链接 | 什么时候读、读到什么程度 |
|---|---|---|
| The Rust Programming Language(Rust Book) | https://doc.rust-lang.org/book/ | 本篇最核心的一本;阶段 1–2 通读第 4、5、10、15 章(所有权、结构体、泛型 trait、智能指针),其余章节按需回查 |
| Rust by Example | https://doc.rust-lang.org/rust-by-example/ | 配合 Rust Book 做对照练习,每段代码可直接跑 |
| The Rust Standard Library API 文档 | https://doc.rust-lang.org/std/ | 写代码时随时查 Vec/Option/Result/String 的方法签名,不需要通读 |
| The Rust Reference | https://doc.rust-lang.org/reference/ | 当 Rust Book 没讲清楚语法细节(如生命周期省略规则、宏展开)时回查,不要从头读 |
| The Rustonomicon | https://doc.rust-lang.org/nomicon/ | 阶段 2 以后、写 unsafe 代码前读;前几章理解未定义行为与安全边界即可 |
| Async Book(官方异步指南) | https://rust-lang.github.io/async-book/ | 阶段 5 开始前读第 1、2 章理解 Future 与执行器模型 |
阶段 3:trait 与抽象设计
| 名称 | 链接 | 什么时候读、读到什么程度 |
|---|---|---|
| Rust API Guidelines(官方 API 设计指南) | https://rust-lang.github.io/api-guidelines/ | 阶段 3 通读「类型转换」「构造器」「可见性」三节;写对外公开 crate 前再读一遍 |
| Rust Design Patterns(孔乙己的类型) | https://rust-unofficial.github.io/patterns/ | 作为补充读物,挑「内部可变性」「迭代器」章读 |
阶段 4:智能指针与内部可变性
| 名称 | 链接 | 什么时候读、读到什么程度 |
|---|---|---|
std::boxed::Box API |
https://doc.rust-lang.org/std/boxed/ | 阶段 4 查方法签名;理解 into_inner 与 leak 语义 |
std::rc::Rc 与 std::sync::Arc API |
https://doc.rust-lang.org/std/rc/ 、https://doc.rust-lang.org/std/sync/struct.Arc.html | 对照读:两者 API 几乎一致,差别在 Send/Sync 与原子计数 |
std::cell 模块文档 |
https://doc.rust-lang.org/std/cell/ | 理解 Cell/RefCell/UnsafeCell 的关系;读 borrow_mut panic 触发条件 |
阶段 5:并发与异步
| 名称 | 链接 | 什么时候读、读到什么程度 |
|---|---|---|
| Tokio 官方教程 | https://tokio.rs/tokio/tutorial | 阶段 5 主线教程,从「Hello Tokio」到 select 与任务取消,逐节做完 |
| Tokio API 文档 | https://docs.rs/tokio | 写代码时查 spawn/JoinSet/mpsc/watch/Mutex/net 的签名与示例 |
std::sync 模块文档 |
https://doc.rust-lang.org/std/sync/ | 对照 Tokio 查 Mutex/RwLock/OnceLock/Condvar 在同步代码中的用法 |
std::marker 模块文档(Send/Sync) |
https://doc.rust-lang.org/std/marker/ | 理解 Send/Sync 是自动派生的 marker trait,读源码注释即可 |
阶段 6:Cargo 工程化与质量体系
| 名称 | 链接 | 什么时候读、读到什么程度 |
|---|---|---|
| Clippy 官方 lint 列表 | https://rust-lang.github.io/rust-clippy/master/ | 阶段 6 通读列表标题,把 correctness/suspicious/perf 三组记住;写新 crate 时把默认 lints 全 denylist |
| Cargo 手册:Tests 章节 | https://doc.rust-lang.org/cargo/guide/tests.html | 阶段 6 读单元测试、集成测试、文档测试的目录约定 |
cargo 官方子命令文档 |
https://doc.rust-lang.org/cargo/commands/ | 查 cargo fix/cargo clippy/cargo audit/cargo tree 的参数 |
| The Rust Documentation | https://doc.rust-lang.org/rustdoc/ | 写文档注释时读,掌握 ///、# Examples、内联链接与文档测试 |
阶段 7:Web 服务全链路
| 名称 | 链接 | 什么时候读、读到什么程度 |
|---|---|---|
| axum 官方文档 | https://docs.rs/axum | 阶段 7 主线框架;先读「示例」与「提取器」「错误处理」两节,再按需查状态码响应 |
| Tower HTTP 中间件文档 | https://docs.rs/tower-http | 查 trace/cors/limit/auth 的配置示例 |
| SQLx 官方文档 | https://docs.rs/sqlx | 读 query!/query_as! 宏与 PgPool/MySqlPool 的示例;编译期校验需要 DATABASE_URL |
| serde 官方文档 | https://serde.rs/ | 阶段 7 读「Attributes」一节掌握 #[serde(rename_all)]/skip_serializing_if 等 |
| tracing 官方文档 | https://docs.rs/tracing | 读「Quick start」与 tracing-subscriber 的初始化示例 |
| actix-web 官方文档 | https://actix.rs/docs/ | 评估或维护 actix 项目时对照 axum 读;不是本篇主线 |
阶段 8:生态延伸与架构收敛(可选)
| 名称 | 链接 | 什么时候读、读到什么程度 |
|---|---|---|
| Tauri v2 官方文档 | https://v2.tauri.app/ | 阶段 8 选桌面方向时读「Getting Started」与「Command」「Capability」三节 |
| wasm-bindgen 官方文档 | https://rustwasm.github.io/wasm-bindgen/ | 阶段 8 选 WASM 方向时读「Introduction」与「Exporting Rust APIs to JS」 |
| wasm-pack 官方文档 | https://rustwasm.github.io/wasm-pack/ | 把 wasm 包发布到 npm 前读「Commands」 |
| The Embedded Rust Book | https://docs.rust-embedded.org/book/ | 阶段 8 选嵌入式方向时读「No standard library」与「Peripherals」两章 |
| PyO3 官方文档 | https://pyo3.rs/ | 写 Rust 扩展给 Python 用时读「Getting Started」与「Function」章 |
The no_std 指南(embedded WG 维护) |
https://docs.rust-embedded.org/embedonomicon/ | 写 bare-metal 代码前读;比嵌入式书更贴近底层 |
通用回查入口
| 名称 | 链接 | 用途 |
|---|---|---|
| Rust 官方文档首页 | https://doc.rust-lang.org/ | 以上所有官方资料的总入口 |
| Rust 语言 Frequently Asked Questions | https://prev.rust-lang.org/faq.html | 遇到「为什么 Rust 这么设计」类问题时查 |
| Rust 编译错误索引(Rust 官方 error codes) | https://doc.rust-lang.org/error_codes/error-index.html | 看到 E0382/E0502/E0117 这类错误码时直接查 |