欢迎来到 Comprehensive Rust 🦀
1.
课程实施
❱
1.1.
课程结构
1.2.
快捷键
2.
使用 Cargo
❱
2.1.
Rust 生态
2.2.
代码示例
2.3.
本地运行 Cargo
第 1 天:上午
3.
欢迎
❱
3.1.
Rust 是什么?
4.
Hello World!
❱
4.1.
小示例
5.
为什么使用 Rust?
❱
5.1.
编译期保证
5.2.
运行时保证
5.3.
现代化特性
6.
基础语法
❱
6.1.
标量类型
6.2.
复合类型
6.3.
引用
❱
6.3.1.
垂悬引用
6.4.
切片
❱
6.4.1.
String 与 str
6.5.
函数
❱
6.5.1.
方法
6.5.2.
重载
7.
练习
❱
7.1.
隐式转换
7.2.
数组和 for 循环
第 1 天:下午
8.
变量
❱
8.1.
类型推导
8.2.
static & const
8.3.
作用域和遮蔽
9.
内存管理
❱
9.1.
堆和栈
9.2.
栈内存
9.3.
手动内存管理
9.4.
基于作用域的内存管理
9.5.
垃圾回收
9.6.
Rust 内存管理
9.7.
对比
10.
所有权
❱
10.1.
移动语义
10.2.
Rust 中移动字符串
❱
10.2.1.
现代 C++ 的 Double Frees
10.3.
函数调用中的移动
10.4.
复制和克隆
10.5.
借用
❱
10.5.1.
Shared and Unique Borrows
10.6.
Lifetimes
10.7.
Lifetimes in Function Calls
10.8.
Lifetimes in Data Structures
11.
练习
❱
11.1.
Designing a Library
11.2.
Iterators and Ownership
Day 2: Morning
12.
欢迎
13.
Structs
❱
13.1.
Tuple Structs
13.2.
Field Shorthand Syntax
14.
Enums
❱
14.1.
Variant Payloads
14.2.
Enum Sizes
15.
方法
❱
15.1.
Method Receiver
15.2.
Example
16.
Pattern Matching
❱
16.1.
Destructuring Enums
16.2.
Destructuring Structs
16.3.
Destructuring Arrays
16.4.
Match Guards
17.
练习
❱
17.1.
Health Statistics
17.2.
Points and Polygons
Day 2: Afternoon
18.
Control Flow
❱
18.1.
Blocks
18.2.
if expressions
18.3.
if let expressions
18.4.
while expressions
18.5.
while let expressions
18.6.
for expressions
18.7.
loop expressions
18.8.
match expressions
18.9.
break & continue
19.
Standard Library
❱
19.1.
String
19.2.
Option and Result
19.3.
Vec
19.4.
HashMap
19.5.
Box
❱
19.5.1.
Recursive Data Types
19.5.2.
Niche Optimization
19.6.
Rc
20.
Modules
❱
20.1.
Visibility
20.2.
Paths
20.3.
Filesystem Hierarchy
21.
练习
❱
21.1.
Luhn Algorithm
21.2.
Strings and Iterators
Day 3: Morning
22.
欢迎
23.
Traits
❱
23.1.
Deriving Traits
23.2.
Default Methods
23.3.
Important Traits
❱
23.3.1.
Iterator
23.3.2.
FromIterator
23.3.3.
From and Into
23.3.4.
Read and Write
23.3.5.
Add, Mul, ...
23.3.6.
Drop
24.
Generics
❱
24.1.
Generic Data Types
24.2.
Generic Methods
24.3.
Trait Bounds
24.4.
impl Trait
24.5.
Closures
24.6.
Monomorphization
24.7.
Trait Objects
25.
练习
❱
25.1.
A Simple GUI Library
Day 3: Afternoon
26.
Error Handling
❱
26.1.
Panics
❱
26.1.1.
Catching Stack Unwinding
26.2.
Structured Error Handling
26.3.
Propagating Errors with ?
❱
26.3.1.
Converting Error Types
26.3.2.
Deriving Error Enums
26.3.3.
Dynamic Error Types
26.3.4.
Adding Context to Errors
27.
Testing
❱
27.1.
Unit Tests
27.2.
Test Modules
27.3.
Documentation Tests
27.4.
Integration Tests
28.
Unsafe Rust
❱
28.1.
Dereferencing Raw Pointers
28.2.
Mutable Static Variables
28.3.
Unions
28.4.
Calling Unsafe Functions
❱
28.4.1.
Writing Unsafe Functions
28.4.2.
Extern Functions
28.5.
Implementing Unsafe Traits
29.
练习
❱
29.1.
Safe FFI Wrapper
Day 4: Morning
30.
欢迎
31.
Concurrency
❱
31.1.
Threads
31.2.
Scoped Threads
31.3.
Channels
❱
31.3.1.
Unbounded Channels
31.3.2.
Bounded Channels
31.4.
Shared State
❱
31.4.1.
Arc
31.4.2.
Mutex
31.4.3.
Example
31.5.
Send and Sync
❱
31.5.1.
Send
31.5.2.
Sync
31.5.3.
Examples
32.
练习
❱
32.1.
Dining Philosophers
32.2.
Multi-threaded Link Checker
Day 4: Afternoon
33.
Android
❱
33.1.
Setup
33.2.
Build Rules
❱
33.2.1.
Binary
33.2.2.
Library
33.3.
AIDL
❱
33.3.1.
Interface
33.3.2.
Implementation
33.3.3.
Server
33.3.4.
Deploy
33.3.5.
Client
33.3.6.
Changing API
33.4.
Logging
33.5.
Interoperability
❱
33.5.1.
With C
❱
33.5.1.1.
Calling C with Bindgen
33.5.1.2.
Calling Rust from C
33.5.2.
With C++
33.5.3.
With Java
34.
练习
Final Words
35.
Thanks!
36.
Other Resources
37.
Credits
Solutions
38.
Solutions
❱
38.1.
Day 1 Morning
38.2.
Day 1 Afternoon
38.3.
Day 2 Morning
38.4.
Day 2 Afternoon
38.5.
Day 3 Morning
38.6.
Day 3 Afternoon
38.7.
Day 4 Morning
Light
Rust
Coal
Navy
Ayu
Comprehensive Rust 🦀
Day 2: Afternoon Exercises
The exercises for this afternoon will focus on strings and iterators.
在看完练习后,你可以看看提供的[解决方案]。