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
❱
3.1.
What is Rust?
4.
Hello World!
❱
4.1.
Small Example
5.
Why Rust?
❱
5.1.
An Example in C
5.2.
Compile Time Guarantees
5.3.
Runtime Guarantees
5.4.
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.
Variables
❱
7.1.
Type Inference
7.2.
static & const
7.3.
Scopes and Shadowing
8.
Control Flow
❱
8.1.
Blocks
8.2.
if expressions
8.3.
for expressions
8.4.
while expressions
8.5.
break & continue
8.6.
loop expressions
9.
Novel Control Flow
❱
9.1.
if let expressions
9.2.
while let expressions
9.3.
match expressions
10.
Standard Library
❱
10.1.
String
10.2.
Vec
10.3.
HashMap
10.4.
Box
❱
10.4.1.
Recursive Data Types
Day 1: Afternoon
11.
Memory Management
❱
11.1.
Stack vs Heap
11.2.
Stack Memory
11.3.
Manual Memory Management
11.4.
Scope-Based Memory Management
11.5.
Garbage Collection
11.6.
Rust Memory Management
12.
Ownership
❱
12.1.
Move Semantics
12.2.
Moved Strings in Rust
❱
12.2.1.
Double Frees in Modern C++
12.3.
Moves in Function Calls
12.4.
Copying and Cloning
12.5.
Borrowing
❱
12.5.1.
Shared and Unique Borrows
12.6.
Lifetimes
12.7.
Lifetimes in Function Calls
12.8.
Lifetimes in Data Structures
13.
Modules
❱
13.1.
Visibility
13.2.
Paths
13.3.
Filesystem Hierarchy
Day 1: Exercises
14.
Exercises
❱
14.1.
Arrays and for Loops
14.2.
Luhn Algorithm
Day 2: Morning
15.
Welcome
16.
Structs
❱
16.1.
Tuple Structs
16.2.
Field Shorthand Syntax
17.
Methods
❱
17.1.
Method Receiver
17.2.
Example
18.
Enums
❱
18.1.
Variant Payloads
18.2.
Enum Sizes
19.
Pattern Matching
❱
19.1.
Destructuring Enums
19.2.
Destructuring Structs
19.3.
Destructuring Arrays
19.4.
Match Guards
20.
Error Handling
❱
20.1.
Option and Result
20.2.
Panics
❱
20.2.1.
Catching Stack Unwinding
20.3.
Structured Error Handling
20.4.
Propagating Errors with ?
❱
20.4.1.
Converting Error Types
❱
20.4.1.1.
Example
20.4.2.
Deriving Error Enums
20.4.3.
Dynamic Error Types
20.4.4.
Adding Context to Errors
Day 2: Afternoon
21.
Generics
❱
21.1.
Generic Data Types
21.2.
Generic Methods
21.3.
Monomorphization
22.
Traits
❱
22.1.
Trait Objects
22.2.
Deriving Traits
22.3.
Default Methods
22.4.
Trait Bounds
22.5.
impl Trait
23.
Important Traits
❱
23.1.
Iterator
23.2.
FromIterator
23.3.
From and Into
23.4.
Read and Write
23.5.
Drop
23.6.
Default
23.7.
Operators: Add, Mul, ...
23.8.
Closures: Fn, FnMut, FnOnce
24.
Unsafe Rust
❱
24.1.
Dereferencing Raw Pointers
24.2.
Mutable Static Variables
24.3.
Unions
24.4.
Calling Unsafe Functions
❱
24.4.1.
Writing Unsafe Functions
24.4.2.
Extern Functions
24.5.
Implementing Unsafe Traits
Day 2: Exercises
25.
Exercises
❱
25.1.
Storing Books
25.2.
Points and Polygons
Final Words
26.
Thanks!
27.
Glossary
28.
Other Resources
29.
Credits
Solutions
30.
Solutions
❱
30.1.
Day 1
30.2.
Day 2
Light
Rust
Coal
Navy
Ayu
Comprehensive Rust 🦀
English
Brazilian Portuguese (Português do Brasil)
Chinese Simplified (汉语)
Korean (한국어)
Spanish (Español)
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.