Welcome to Comprehensive Rust 🦀
1.
Running the Course
❱
1.1.
Course Structure
1.2.
Keyboard Shortcuts
1.3.
Translations
2.
Using Cargo
❱
2.1.
Rust Ecosystem
2.2.
Code Samples
2.3.
Running Cargo Locally
Day 1: Morning
3.
Welcome
4.
Hello, World
❱
4.1.
What is Rust?
4.2.
Hello, World
4.3.
Benefits of Rust
4.4.
Playground
5.
Types and Values
❱
5.1.
Variables
5.2.
Values
5.3.
Arithmetic
5.4.
Strings
5.5.
Type Inference
5.6.
Exercise: Fibonacci
❱
5.6.1.
Solution
6.
Control Flow Basics
❱
6.1.
Conditionals
6.2.
Loops
6.3.
break and continue
6.4.
Blocks and Scopes
6.5.
Functions
6.6.
Macros
6.7.
Exercise: Collatz Sequence
❱
6.7.1.
Solution
Day 1: Afternoon
7.
Welcome
8.
Tuples and Arrays
❱
8.1.
Tuples and Arrays
8.2.
Array Iteration
8.3.
Pattern Matching
8.4.
Destructuring
8.5.
Exercise: Nested Arrays
❱
8.5.1.
Solution
9.
References
❱
9.1.
Shared References
9.2.
Exclusive References
9.3.
Exercise: Geometry
❱
9.3.1.
Solution
10.
User-Defined Types
❱
10.1.
Named Structs
10.2.
Tuple Structs
10.3.
Enums
10.4.
Static and Const
10.5.
Type Aliases
10.6.
Exercise: Elevator Events
❱
10.6.1.
Solution
Day 2: Morning
11.
Welcome
12.
Pattern Matching
❱
12.1.
Destructuring
12.2.
Let Control Flow
12.3.
Exercise: Expression Evaluation
❱
12.3.1.
Solution
13.
Methods and Traits
❱
13.1.
Methods
13.2.
Traits
13.3.
Deriving
13.4.
Exercise: Generic Logger
❱
13.4.1.
Solution
14.
Generics
❱
14.1.
Generic Functions
14.2.
Generic Data Types
14.3.
Trait Bounds
14.4.
impl Trait
14.5.
Exercise: Generic min
❱
14.5.1.
Solution
Day 2: Afternoon
15.
Welcome
16.
Standard Library Types
❱
16.1.
Standard Library
16.2.
Documentation
16.3.
Option
16.4.
Result
16.5.
String
16.6.
Vec
16.7.
HashMap
16.8.
Exercise: Counter
❱
16.8.1.
Solution
17.
Standard Library Traits
❱
17.1.
Comparisons
17.2.
Operators
17.3.
From and Into
17.4.
Casting
17.5.
Read and Write
17.6.
Default, struct update syntax
17.7.
Closures
17.8.
Exercise: ROT13
❱
17.8.1.
Solution
Day 3: Morning
18.
Welcome
19.
Memory Management
❱
19.1.
Review of Program Memory
19.2.
Approaches to Memory Management
19.3.
Ownership
19.4.
Move Semantics
19.5.
Clone
19.6.
Copy Types
19.7.
Drop
19.8.
Exercise: Builder Type
❱
19.8.1.
Solution
20.
Smart Pointers
❱
20.1.
Box<T>
20.2.
Rc
20.3.
Trait Objects
20.4.
Exercise: Binary Tree
❱
20.4.1.
Solution
Day 3: Afternoon
21.
Welcome
22.
Borrowing
❱
22.1.
Borrowing a Value
22.2.
Borrow Checking
22.3.
Interior Mutability
22.4.
Exercise: Health Statistics
❱
22.4.1.
Solution
23.
Slices and Lifetimes
❱
23.1.
Slices: &[T]
23.2.
String References
23.3.
Lifetime Annotations
23.4.
Lifetime Elision
23.5.
Struct Lifetimes
23.6.
Exercise: Protobuf Parsing
❱
23.6.1.
Solution
Day 4: Morning
24.
Welcome
25.
Iterators
❱
25.1.
Iterator
25.2.
IntoIterator
25.3.
FromIterator
25.4.
Exercise: Iterator Method Chaining
❱
25.4.1.
Solution
26.
Modules
❱
26.1.
Modules
26.2.
Filesystem Hierarchy
26.3.
Visibility
26.4.
use, super, self
26.5.
Exercise: Modules for a GUI Library
❱
26.5.1.
Solution
27.
Testing
❱
27.1.
Test Modules
27.2.
Other Types of Tests
27.3.
Useful Crates
27.4.
GoogleTest
27.5.
Mocking
27.6.
Compiler Lints and Clippy
27.7.
Exercise: Luhn Algorithm
❱
27.7.1.
Solution
Day 4: Afternoon
28.
Welcome
29.
Error Handling
❱
29.1.
Panics
29.2.
Try Operator
29.3.
Try Conversions
29.4.
Error Trait
29.5.
thiserror and anyhow
29.6.
Exercise: Rewriting with Result
❱
29.6.1.
Solution
30.
Unsafe Rust
❱
30.1.
Unsafe
30.2.
Dereferencing Raw Pointers
30.3.
Mutable Static Variables
30.4.
Unions
30.5.
Unsafe Functions
30.6.
Unsafe Traits
30.7.
Exercise: FFI Wrapper
❱
30.7.1.
Solution
Android
31.
Welcome
32.
Setup
33.
Build Rules
❱
33.1.
Binary
33.2.
Library
34.
AIDL
❱
34.1.
Interface
34.2.
Implementation
34.3.
Server
34.4.
Deploy
34.5.
Client
34.6.
Changing API
35.
Logging
36.
Interoperability
❱
36.1.
With C
❱
36.1.1.
Calling C with Bindgen
36.1.2.
Calling Rust from C
36.2.
With C++
❱
36.2.1.
The Bridge Module
36.2.2.
Rust Bridge
36.2.3.
Generated C++
36.2.4.
C++ Bridge
36.2.5.
Shared Types
36.2.6.
Shared Enums
36.2.7.
Rust Error Handling
36.2.8.
C++ Error Handling
36.2.9.
Additional Types
36.2.10.
Building for Android: C++
36.2.11.
Building for Android: Genrules
36.2.12.
Building for Android: Rust
36.3.
With Java
37.
Exercises
Chromium
38.
Welcome
39.
Setup
40.
Comparing Chromium and Cargo Ecosystems
41.
Policy
42.
Build Rules
❱
42.1.
Unsafe Code
42.2.
Depending on Rust Code from Chromium C++
42.3.
Visual Studio Code
42.4.
Exercise
43.
Testing
❱
43.1.
rust_gtest_interop Library
43.2.
GN Rules for Rust Tests
43.3.
chromium::import! Macro
43.4.
Exercise
44.
Interoperability with C++
❱
44.1.
Example Bindings
44.2.
Limitations of CXX
44.3.
CXX Error Handling
❱
44.3.1.
Error Handling: QR Example
44.3.2.
Error Handling: PNG Example
44.4.
Using CXX in Chromium
44.5.
Exercise
45.
Adding Third Party Crates
❱
45.1.
Configuring Cargo.toml
45.2.
Configuring gnrt_config.toml
45.3.
Downloading Crates
45.4.
Generating gn Build Rules
45.5.
Resolving Problems
❱
45.5.1.
Build Scripts Which Generate Code
45.5.2.
Build Scripts Which Build C++ or Take Arbitrary Actions
45.6.
Depending on a Crate
45.7.
Reviews and Audits
45.8.
Checking into Chromium Source Code
45.9.
Keeping Crates Up to Date
45.10.
Exercise
46.
Bringing It Together - Exercise
47.
Exercise Solutions
Bare Metal: Morning
48.
Welcome
49.
no_std
❱
49.1.
A Minimal Example
49.2.
alloc
50.
Microcontrollers
❱
50.1.
Raw MMIO
50.2.
PACs
50.3.
HAL Crates
50.4.
Board Support Crates
50.5.
The Type State Pattern
50.6.
embedded-hal
50.7.
probe-rs and cargo-embed
❱
50.7.1.
Debugging
50.8.
Other Projects
51.
Exercises
❱
51.1.
Compass
51.2.
Solutions
Bare Metal: Afternoon
52.
Application Processors
❱
52.1.
Getting Ready to Rust
52.2.
Inline Assembly
52.3.
MMIO
52.4.
Let's Write a UART Driver
❱
52.4.1.
More Traits
52.5.
A Better UART Driver
❱
52.5.1.
Bitflags
52.5.2.
Multiple Registers
52.5.3.
Driver
52.5.4.
Using It
52.6.
Logging
❱
52.6.1.
Using It
52.7.
Exceptions
52.8.
Other Projects
53.
Useful Crates
❱
53.1.
zerocopy
53.2.
aarch64-paging
53.3.
buddy_system_allocator
53.4.
tinyvec
53.5.
spin
54.
Android
❱
54.1.
vmbase
55.
Exercises
❱
55.1.
RTC Driver
55.2.
Solutions
Concurrency: Morning
56.
Welcome
57.
Threads
❱
57.1.
Scoped Threads
58.
Channels
❱
58.1.
Unbounded Channels
58.2.
Bounded Channels
59.
Send and Sync
❱
59.1.
Send
59.2.
Sync
59.3.
Examples
60.
Shared State
❱
60.1.
Arc
60.2.
Mutex
60.3.
Example
61.
Exercises
❱
61.1.
Dining Philosophers
61.2.
Multi-threaded Link Checker
61.3.
Solutions
Concurrency: Afternoon
62.
Async Basics
❱
62.1.
async/await
62.2.
Futures
62.3.
Runtimes
❱
62.3.1.
Tokio
62.4.
Tasks
62.5.
Async Channels
63.
Control Flow
❱
63.1.
Join
63.2.
Select
64.
Pitfalls
❱
64.1.
Blocking the Executor
64.2.
Pin
64.3.
Async Traits
64.4.
Cancellation
65.
Exercises
❱
65.1.
Dining Philosophers
65.2.
Broadcast Chat Application
65.3.
Solutions
Final Words
66.
Thanks!
67.
Glossary
68.
Other Resources
69.
Credits
Light
Rust
Coal
Navy
Ayu
Comprehensive Rust 🦀
English
Brazilian Portuguese (Português do Brasil)
Chinese Simplified (汉语)
Chinese Traditional (漢語)
Korean (한국어)
Spanish (Español)
Hello, World
In this segment:
What is Rust?
(10 minutes)
Hello, World
(5 minutes)
Benefits of Rust
(3 minutes)
Playground
(2 minutes)
This segment should take about 20 minutes