A comprehensive guide to learning Rust for developers with C# experience. This guide covers everything from basic syntax to advanced patterns, focusing on the conceptual shifts and practical differences between the two languages.
This material works both as an instructor-led course and for self-study. If you're working through it on your own, here's how to get the most out of it.
Pacing recommendations:
| Chapters | Topic | Suggested Time | Checkpoint |
|---|---|---|---|
| 1–4 | Setup, types, control flow | 1 day | You can write a CLI temperature converter in Rust |
| 5–6 | Data structures, enums, pattern matching | 1–2 days | You can define an enum with data and match exhaustively on it |
| 7 | Ownership and borrowing | 1–2 days | You can explain why let s2 = s1 invalidates s1 |
| 8–9 | Modules, error handling | 1 day | You can create a multi-file project that propagates errors with ? |
| 10–12 | Traits, generics, closures, iterators | 1–2 days | You can translate a LINQ chain to Rust iterators |
| 13 | Concurrency and async | 1 day | You can write a thread-safe counter with Arc<Mutex<T>> |
| 14 | Unsafe Rust, FFI, testing | 1 day | You can call a Rust function from C# via P/Invoke |
| 15–16 | Migration, best practices, tooling | At your own pace | Reference material — consult as you write real code |
| 17 | Capstone project | 1–2 days | You have a working CLI tool that fetches weather data |
How to use the exercises:
<details> blocks with solutionsDifficulty indicators:
When you hit a wall:
Vec<T> vs List<T>Option<T> for Null SafetyResult<T, E>