google/comprehensive-rust
GitHub: google/comprehensive-rust
Google Android 团队使用的多日 Rust 培训课程,覆盖从基础语法到并发和裸金属开发的完整教学内容。
Stars: 33156 | Forks: 2038
# 全面的 Rust 🦀
[](https://github.com/google/comprehensive-rust/actions/workflows/build.yml?query=branch%3Amain)
[](https://github.com/google/comprehensive-rust/graphs/contributors)
[](https://github.com/google/comprehensive-rust/stargazers)
本仓库包含了 Comprehensive Rust 🦀 的源代码,这是一门由 Android 团队开发的多日 Rust 课程。该课程涵盖了 Rust 的各个方面,从基本语法到泛型和错误处理。它还包括关于 [Android]、[Chromium]、[bare-metal] 和 [concurrency] 的深入探讨。
请在 **https://google.github.io/comprehensive-rust/** 阅读本课程。
## 课程形式与目标受众
本课程在 Google 内部用于向经验丰富的软件工程师(通常具有 C++ 或 Java 背景)教授 Rust。
本课程在课堂环境中讲授,我们希望它能对其他想要向其团队教授 Rust 的人有所帮助。本课程不太适合自学,因为你会错过课堂上的讨论。你将看不到那些问答,也看不到我们在浏览代码示例时触发的编译器错误。我们希望通过[演讲者备注](https://github.com/google/comprehensive-rust/issues/53)以及[发布视频](https://github.com/google/comprehensive-rust/issues/52)来改善自学体验。
## 新闻报道
网络上关于 Comprehensive Rust 的文章和博客文章:
- 2023-09-08:
_[在 5 天内教授 Rust](https://mo8it.com/blog/teaching-rust/)_。
Comprehensive Rust 被用作一门为期 5 天的大学 Rust 课程的基础。
- 2023-09-21:
_[通过培训扩大 Rust 的应用规模](https://security.googleblog.com/2023/09/scaling-rust-adoption-through-training.html)_。
我们发布了一篇博客文章,详细介绍了本课程的开发过程。
- 2023-10-02:
_[寻找 Rust 开发者,公司转向内部培训](https://www.darkreading.com/application-security/seeking-rust-developers-in-house-training)_。
关于 Microsoft、Google 等其他公司如何培训人员学习 Rust。
- 2024-10-18:
_[大规模 Rust 培训 | Rust Global @ RustConf 2024](https://youtu.be/7h5KyMqt2-Q?si=4M99HdWWxMaqN8Zr)_。
Google 在教授 Comprehensive Rust 超过两年时间里的经验总结。
## 环境设置
本课程使用以下工具构建:
- [mdbook](https://github.com/rust-lang/mdBook)
- [mdbook-svgbob](https://github.com/boozook/mdbook-svgbob)
- [mdbook-i18n-helpers 和 i18n-report](https://github.com/google/mdbook-i18n-helpers)
- [mdbook-exerciser](mdbook-exerciser/)
- [mdbook-course](mdbook-course/)
- [mdbook-linkcheck2](https://github.com/marxin/mdbook-linkcheck2)
- [Bazel](https://bazel.build/)
首先,按照 https://rustup.rs/ 上的说明安装 Rust。接下来,通过 [Bazelisk 版本管理器](https://github.com/bazelbuild/bazelisk)安装 Bazel。然后克隆本仓库:
```
git clone https://github.com/google/comprehensive-rust/
cd comprehensive-rust
```
接着运行以下命令,以安装上述所有工具的正确版本:
```
cargo xtask install-tools
```
之后,你可以在 `~/.cargo/bin/` 目录中找到这些工具。
## 命令
以下是你在项目中可以运行的一些常用命令。运行 `cargo xtask` 以查看所有可用命令。
| 命令 | 描述 |
| --------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `cargo xtask install-tools` | 安装项目依赖的所有工具。 |
| `cargo xtask serve` | 启动一个带有课程内容的 web server。你可以在 http://localhost:3000 上找到内容。要提供课程的任何翻译版本,请添加语言标志(--language 或 -l),后跟 xx,其中 xx 是 ISO 639 语言代码(例如,对于丹麦语翻译,使用 `cargo xtask serve -l da`)。 |
| `cargo xtask rust-tests` | 测试包含的 Rust 代码片段。 |
| `cargo xtask web-tests` | 在 tests 目录中运行 web driver 测试。 |
| `cargo xtask build` | 在 `book/` 目录中创建课程的静态版本。请注意,你必须单独构建练习并压缩它们,然后将它们添加到 `book/html` 中。要构建课程的任何翻译版本,请添加语言标志(--language 或 -l),后跟 xx,其中 xx 是 ISO 639 语言代码(例如,对于丹麦语翻译,使用 `cargo xtask build -l da`)。[TRANSLATIONS.md](TRANSLATIONS.md) 包含了进一步的说明。 |
## 许可证
本项目采用 Apache License 2.0 和 Creative Commons Attribution 4.0 International License 的混合许可。
- **源代码:** 所有源代码文件以及嵌入在文档中的代码示例均根据 [Apache License, Version 2.0](LICENSE) 获得许可。
- **文档与内容:** 所有非源代码资产——特别是 Markdown(`.md`)文件、文档和图像——均根据 [Creative Commons Attribution 4.0 International License](LICENSE-CC-BY) 获得许可。
## 联系方式
如有任何问题或意见,请联系
[Martin Geisler](mailto:mgeisler@google.com) 或在
[GitHub 上发起讨论](https://github.com/google/comprehensive-rust/discussions)。
我们非常乐意倾听你的反馈。
标签:Android, DSL, Rust, 可视化界面, 学习资源, 开源文档, 系统编程, 编程教程, 网络流量审计, 通知系统