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.
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.
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.
Variables
❱
9.1.
Type Inference
9.2.
static & const
9.3.
Scopes and Shadowing
10.
Enums
❱
10.1.
Variant Payloads
10.2.
Enum Sizes
11.
Novel Control Flow
❱
11.1.
if let expressions
11.2.
while let expressions
11.3.
match expressions
12.
Pattern Matching
❱
12.1.
Destructuring Enums
12.2.
Destructuring Structs
12.3.
Destructuring Arrays
12.4.
Match Guards
13.
Exercises
❱
13.1.
Luhn Algorithm
13.2.
Pattern Matching
Day 2: Morning
14.
Welcome
15.
Memory Management
❱
15.1.
Stack vs Heap
15.2.
Stack Memory
15.3.
Manual Memory Management
15.4.
Scope-Based Memory Management
15.5.
Garbage Collection
15.6.
Rust Memory Management
16.
Ownership
❱
16.1.
Move Semantics
16.2.
Moved Strings in Rust
❱
16.2.1.
Double Frees in Modern C++
16.3.
Moves in Function Calls
16.4.
Copying and Cloning
16.5.
Borrowing
❱
16.5.1.
Shared and Unique Borrows
16.6.
Lifetimes
16.7.
Lifetimes in Function Calls
16.8.
Lifetimes in Data Structures
17.
Structs
❱
17.1.
Tuple Structs
17.2.
Field Shorthand Syntax
18.
Methods
❱
18.1.
Method Receiver
18.2.
Example
19.
Exercises
❱
19.1.
Storing Books
19.2.
Health Statistics
Day 2: Afternoon
20.
Standard Library
❱
20.1.
Option and Result
20.2.
String
20.3.
Vec
20.4.
HashMap
20.5.
Box
❱
20.5.1.
Recursive Data Types
20.5.2.
Niche Optimization
20.6.
Rc
20.7.
Cell/RefCell
21.
Modules
❱
21.1.
Visibility
21.2.
Paths
21.3.
Filesystem Hierarchy
22.
Exercises
❱
22.1.
Iterators and Ownership
22.2.
Strings and Iterators
Day 3: Morning
23.
Welcome
24.
Generics
❱
24.1.
Generic Data Types
24.2.
Generic Methods
24.3.
Monomorphization
25.
Traits
❱
25.1.
Trait Objects
25.2.
Deriving Traits
25.3.
Default Methods
25.4.
Trait Bounds
25.5.
impl Trait
26.
Important Traits
❱
26.1.
Iterator
26.2.
FromIterator
26.3.
From and Into
26.4.
Read and Write
26.5.
Drop
26.6.
Default
26.7.
Operators: Add, Mul, ...
26.8.
Closures: Fn, FnMut, FnOnce
27.
Exercises
❱
27.1.
A Simple GUI Library
27.2.
Points and Polygons
Day 3: Afternoon
28.
Error Handling
❱
28.1.
Panics
❱
28.1.1.
Catching Stack Unwinding
28.2.
Structured Error Handling
28.3.
Propagating Errors with ?
❱
28.3.1.
Converting Error Types
❱
28.3.1.1.
Example
28.3.2.
Deriving Error Enums
28.3.3.
Dynamic Error Types
28.3.4.
Adding Context to Errors
29.
Testing
❱
29.1.
Unit Tests
29.2.
Test Modules
29.3.
Documentation Tests
29.4.
Integration Tests
29.5.
Useful crates
30.
Unsafe Rust
❱
30.1.
Dereferencing Raw Pointers
30.2.
Mutable Static Variables
30.3.
Unions
30.4.
Calling Unsafe Functions
❱
30.4.1.
Writing Unsafe Functions
30.4.2.
Extern Functions
30.5.
Implementing Unsafe Traits
31.
Exercises
❱
31.1.
Safe FFI Wrapper
Android
32.
Welcome
33.
Setup
34.
Build Rules
❱
34.1.
Binary
34.2.
Library
35.
AIDL
❱
35.1.
Interface
35.2.
Implementation
35.3.
Server
35.4.
Deploy
35.5.
Client
35.6.
Changing API
36.
Logging
37.
Interoperability
❱
37.1.
With C
❱
37.1.1.
Calling C with Bindgen
37.1.2.
Calling Rust from C
37.2.
With C++
37.3.
With Java
38.
Exercises
Bare Metal: Morning
39.
Welcome
40.
no_std
❱
40.1.
A Minimal Example
40.2.
alloc
41.
Microcontrollers
❱
41.1.
Raw MMIO
41.2.
PACs
41.3.
HAL Crates
41.4.
Board Support Crates
41.5.
The Type State Pattern
41.6.
embedded-hal
41.7.
probe-rs, cargo-embed
❱
41.7.1.
Debugging
41.8.
Other Projects
42.
Exercises
❱
42.1.
Compass
Bare Metal: Afternoon
43.
Application Processors
❱
43.1.
Getting Ready to Rust
43.2.
Inline Assembly
43.3.
MMIO
43.4.
Let's Write a UART Driver
❱
43.4.1.
More Traits
43.5.
A Better UART Driver
❱
43.5.1.
Bitflags
43.5.2.
Multiple Registers
43.5.3.
Driver
43.5.4.
Using It
43.6.
Logging
❱
43.6.1.
Using It
43.7.
Exceptions
43.8.
Other Projects
44.
Useful Crates
❱
44.1.
zerocopy
44.2.
aarch64-paging
44.3.
buddy_system_allocator
44.4.
tinyvec
44.5.
spin
45.
Android
❱
45.1.
vmbase
46.
Exercises
❱
46.1.
RTC Driver
Concurrency: Morning
47.
Welcome
48.
Threads
❱
48.1.
Scoped Threads
49.
Channels
❱
49.1.
Unbounded Channels
49.2.
Bounded Channels
50.
Send and Sync
❱
50.1.
Send
50.2.
Sync
50.3.
Examples
51.
Shared State
❱
51.1.
Arc
51.2.
Mutex
51.3.
Example
52.
Exercises
❱
52.1.
Dining Philosophers
52.2.
Multi-threaded Link Checker
Concurrency: Afternoon
53.
Async Basics
❱
53.1.
async/await
53.2.
Futures
53.3.
Runtimes
❱
53.3.1.
Tokio
53.4.
Tasks
53.5.
Async Channels
54.
Control Flow
❱
54.1.
Join
54.2.
Select
55.
Pitfalls
❱
55.1.
Blocking the Executor
55.2.
Pin
55.3.
Async Traits
55.4.
Cancellation
56.
Exercises
❱
56.1.
Dining Philosophers
56.2.
Broadcast Chat Application
Final Words
57.
Thanks!
58.
Other Resources
59.
Credits
Solutions
60.
Solutions
❱
60.1.
Day 1 Morning
60.2.
Day 1 Afternoon
60.3.
Day 2 Morning
60.4.
Day 2 Afternoon
60.5.
Day 3 Morning
60.6.
Day 3 Afternoon
60.7.
Bare Metal Rust Morning
60.8.
Bare Metal Rust Afternoon
60.9.
Concurrency Morning
60.10.
Concurrency Afternoon
Light
Rust
Coal
Navy
Ayu
Comprehensive Rust 🦀
English
Brazilian Portuguese (Português do Brasil)
Korean (한국어)
Spanish (Español)
AIDL
The
Android Interface Definition Language (AIDL)
is supported in Rust:
Rust code can call existing AIDL servers,
You can create new AIDL servers in Rust.