课程结构

本页供课程讲师使用。

Rust 基础

前四天的内容是 Rust 基础。这几天的课程节奏很快,内容也很丰富!

课程安排:

  • Day 1 Morning (2 hours and 10 minutes, including breaks)
SegmentDuration
欢迎5 minutes
Hello, World15 minutes
类型和值40 minutes
控制流基础45 minutes
  • Day 1 Afternoon (2 hours and 45 minutes, including breaks)
SegmentDuration
元组和数组35 minutes
引用55 minutes
用户定义的类型1 hour
  • Day 2 Morning (2 hours and 45 minutes, including breaks)
SegmentDuration
欢迎3 minutes
模式匹配50 minutes
方法和特征45 minutes
泛型45 minutes
  • Day 2 Afternoon (2 hours and 50 minutes, including breaks)
SegmentDuration
标准库类型1 hour
闭包30 minutes
标准库特征1 hour
  • 第三天上午(2 小时 20 分钟,含休息时间)
SegmentDuration
欢迎3 minutes
内存管理1 hour
智能指针55 minutes
  • Day 3 Afternoon (1 hour and 55 minutes, including breaks)
SegmentDuration
借用55 minutes
结构体生命周期50 minutes
  • Day 4 Morning (2 hours and 50 minutes, including breaks)
SegmentDuration
欢迎3 minutes
迭代器55 minutes
模块45 minutes
测试45 minutes
  • Day 4 Afternoon (2 hours and 20 minutes, including breaks)
SegmentDuration
错误处理55 minutes
不安全 Rust1 hour and 15 minutes

深入探究

除了为期四天的“Rust 基础”课程外,还有一些专业课题提供:

Android 中的 Rust

深入探究 Android 中的 Rust 课程为期半天,旨在介绍如何使用 Rust 进行 Android 平台开发。其中包括与 C、C++ 和 Java 的互操作性。

你需要 检出 AOSP。在同一机器上检出 课程库, 然后将 src/android/ 目录移至所检出的 AOSP 的根目录。这将确保 Android 构建系统能检测到 src/android/ 中的 Android.bp 文件。

确保 adb sync 适用于你的模拟器或实际设备, 并使用 src/android/build_all.sh 预构建所有 Android 示例。请阅读脚本, 查看它所运行的命令,并确保这些命令能在你手动运行时正确执行。

Chromium 中的 Rust

深入探究 Chromium 中的 Rust 课程为期半天,旨在介绍 Chromium 浏览器中 Rust 的使用。课程内容包括在 Chromium 的 gn 编译系统中使用 Rust,引入第三方 crate,以及与 C++ 的互操作性。

您需要能够构建 Chromium。为了提高速度,建议使用调试、组件 构建方式,其他构建方式也可以使用。确保所构建的 Chromium 浏览器可以正常运行。

裸机 Rust

深入探究 裸机 Rust 课程为期一天,旨在介绍如何使用 Rust 进行裸机(嵌入式)开发。其中涵盖了微控制器和应用处理器。

对于微控制器部分,需要提前购买 BBC micro:bit v2 开发板。每个人都需要安装多个软件包, 具体如 欢迎页面 中所述。

Rust 中的并发

The Concurrency in Rust deep dive is a full day class on classical as well as async/await concurrency.

你需要设置一个新 crate,下载所需的依赖项, 做好课前准备。然后,你可以将示例复制/粘贴到 src/main.rs 中, 以便对以下代码进行实验:

cargo init concurrency
cd concurrency
cargo add tokio --features full
cargo run

课程安排:

  • Morning (3 hours and 20 minutes, including breaks)
SegmentDuration
线程30 minutes
通道20 minutes
Send 和 Sync15 minutes
共享状态30 minutes
习题1 hour and 10 minutes
  • Afternoon (3 hours and 30 minutes, including breaks)
SegmentDuration
异步基础40 minutes
Channels and Control Flow20 minutes
误区55 minutes
习题1 hour and 10 minutes

Idiomatic Rust

The Idiomatic Rust deep dive is a 2-day class on Rust idioms and patterns.

You should be familiar with the material in Rust Fundamentals before starting this course.

课程安排:

  • Morning (25 minutes, including breaks)
SegmentDuration
Leveraging the Type System25 minutes

Unsafe (Work in Progress)

The Unsafe deep dive is a two-day class on the unsafe Rust language. It covers the fundamentals of Rust’s safety guarantees, the motivation for unsafe, review process for unsafe code, FFI basics, and building data structures that the borrow checker would normally reject.

课程安排:

  • Day 1 Morning (1 hour, including breaks)
SegmentDuration
设置2 minutes
Motivations20 minutes
Foundations25 minutes

课程形式

本课程的互动性非常强, 建议你以问题驱动探索 Rust!