Welcome to Comprehensive Rust 🦀
1.
Running the Course
❱
1.1.
Course Structure
1.2.
Day 4
1.3.
Keyboard Shortcuts
1.4.
Translations
2.
Using Cargo
❱
2.1.
Rust Ecosystem
2.2.
Code Samples
2.3.
Running Cargo Locally
Day 1: Morning
3.
Welcome
❱
3.1.
What is Rust?
4.
Hello World!
❱
4.1.
Small Example
5.
Why Rust?
❱
5.1.
Compile Time Guarantees
5.2.
Runtime Guarantees
5.3.
Modern Features
6.
Basic Syntax
❱
6.1.
Scalar Types
6.2.
Compound Types
6.3.
References
❱
6.3.1.
Dangling References
6.4.
Slices
❱
6.4.1.
String vs str
6.5.
Functions
❱
6.5.1.
Rustdoc
6.5.2.
Methods
6.5.3.
Overloading
7.
Exercises
❱
7.1.
Implicit Conversions
7.2.
Arrays and for Loops
Day 1: Afternoon
8.
Variables
❱
8.1.
Type Inference
8.2.
static & const
8.3.
Scopes and Shadowing
9.
Memory Management
❱
9.1.
Stack vs Heap
9.2.
Stack Memory
9.3.
Manual Memory Management
9.4.
Scope-Based Memory Management
9.5.
Garbage Collection
9.6.
Rust Memory Management
9.7.
Comparison
10.
Ownership
❱
10.1.
Move Semantics
10.2.
Moved Strings in Rust
❱
10.2.1.
Double Frees in Modern C++
10.3.
Moves in Function Calls
10.4.
Copying and Cloning
10.5.
Borrowing
❱
10.5.1.
Shared and Unique Borrows
10.6.
Lifetimes
10.7.
Lifetimes in Function Calls
10.8.
Lifetimes in Data Structures
11.
Exercises
❱
11.1.
Designing a Library
11.2.
Iterators and Ownership
Day 2: Morning
12.
Welcome
13.
Structs
❱
13.1.
Tuple Structs
13.2.
Field Shorthand Syntax
14.
Enums
❱
14.1.
Variant Payloads
14.2.
Enum Sizes
15.
Methods
❱
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.
Exercises
❱
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.
Option and Result
19.2.
String
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.
Exercises
❱
21.1.
Luhn Algorithm
21.2.
Strings and Iterators
Day 3: Morning
22.
Welcome
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
23.3.7.
Default
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.
Exercises
❱
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.1.1.
Example
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.
Exercises
❱
29.1.
Safe FFI Wrapper
Day 4: Morning
30.
Welcome
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.
Exercises
❱
32.1.
Dining Philosophers
32.2.
Multi-threaded Link Checker
Day 4: Afternoon (Android)
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.
Exercises
Final Words
35.
Thanks!
36.
Other Resources
37.
Credits
Bare Metal Rust: Morning
38.
Welcome
39.
no_std
❱
39.1.
A Minimal Example
39.2.
alloc
40.
Microcontrollers
❱
40.1.
Raw MMIO
40.2.
PACs
40.3.
HAL Crates
40.4.
Board Support Crates
40.5.
The Type State Pattern
40.6.
embedded-hal
40.7.
probe-rs, cargo-embed
❱
40.7.1.
Debugging
40.8.
Other Projects
41.
Exercises
❱
41.1.
Compass
Bare Metal Rust: Afternoon
42.
Application Processors
❱
42.1.
Inline Assembly
42.2.
MMIO
42.3.
Let's Write a UART Driver
❱
42.3.1.
More Traits
42.4.
A Better UART Driver
❱
42.4.1.
Bitflags
42.4.2.
Multiple Registers
42.4.3.
Driver
42.4.4.
Using It
42.5.
Logging
❱
42.5.1.
Using It
42.6.
Other Projects
43.
Useful Crates
❱
43.1.
zerocopy
43.2.
aarch64-paging
43.3.
buddy_system_allocator
43.4.
tinyvec
43.5.
spin
44.
Android
❱
44.1.
vmbase
45.
Exercises
❱
45.1.
RTC Driver
Solutions
46.
Solutions
❱
46.1.
Day 1 Morning
46.2.
Day 1 Afternoon
46.3.
Day 2 Morning
46.4.
Day 2 Afternoon
46.5.
Day 3 Morning
46.6.
Day 3 Afternoon
46.7.
Day 4 Morning
46.8.
Bare Metal Rust Morning
46.9.
Bare Metal Rust Afternoon
Light
Rust
Coal
Navy
Ayu
Comprehensive Rust 🦀
English
Brazilian Portuguese
한국어 (Korean)
Error Handling
Error handling in Rust is done using explicit control flow:
Functions that can have errors list this in their return type,
There are no exceptions.