rust · beginner
Rust: Zero to Hero
Start with no Rust at all and finish having used the language. Each stage is a small function or a tiny project, graded by cargo test in a sandbox with no network.
0 of 35 stages passed. Copy courses/rust-zero-to-hero/starter and work through the map. The reference solution used by CI is not what you submit.
Getting started
01Hello, CargoWrite your first function and see Cargo run the hidden tests.Free- 02Variables and mutabilityBind names, change them only when they are mut, and shadow a binding.Free
Types
03Scalar typesWork with integers, floats, chars, and bools, including wrapping arithmetic.Free- 04Tuples and arraysGroup a fixed handful of values in a tuple or a fixed-size array.Free
Control
05FunctionsPass a function pointer and compute a factorial.Locked- 06Control flowBranch with if and match, and loop until a condition breaks.Locked
Project: guessing game
07Guessing gameJudge guesses against a secret number and count the attempts.LockedOwnership
08OwnershipMove a String into a function, give one back, and clone when you must keep both.Locked- 09Borrowing and referencesRead through a shared reference and update through a mutable one.Locked
- 10SlicesView part of a string or an array without taking ownership.Locked
Data
11StructsGroup named fields and add methods with impl.Locked- 12Enums and pattern matchingModel a direction and a message, and match every variant.Locked
Errors
13Option and ResultRepresent a missing value and a failure without panicking.Locked- 14The question mark and custom errorsReturn your own error type and propagate it with `?`.Locked
Project: dungeon
15Dungeon crawlerMove between two rooms and pick up the key.LockedOrganization
16Modules and cratesSplit a shop into a module and re-export its item type.LockedCollections
17Vec and StringOwn a growable list of strings and join them.Locked- 18HashMapCount words and pick the one that appears most often.Locked
Project: todo list
19Todo listAdd tasks, toggle them, and save the list to a file.LockedAbstraction
20GenericsWrite one function and one struct that work for many types.Locked- 21TraitsDefine shared behavior and accept anything that implements it.Locked
- 22Trait objectsPut different types behind one `&dyn` reference.Locked
- 23LifetimesName how long a borrowed result stays valid.Locked
Project: mini grep
24Mini grepFind lines that contain a query, with and without case.LockedFunctional
25ClosuresPass behavior that can capture its environment.Locked- 26IteratorsTransform a sequence without an index loop.Locked
Project: calculator
27CalculatorEvaluate integer expressions with precedence and parentheses.LockedPointers
28Box and RcPut a list on the heap and share an owned String.Locked- 29RefCell and ArcMutate through a shared reference and share that cell across owners.Locked
Concurrency
30Threads and channelsSplit work onto a thread and pass values through a channel.LockedProject: job pool
31Job poolRun squaring jobs on a fixed set of worker threads.LockedBeyond
32Async basicsWrite async functions the grader can poll to completion.Locked- 33MacrosGenerate a Vec of Strings with macro_rules!.Locked
- 34TestingPractice the assertions the grader uses on your functions.Locked
- 35Unsafe and FFICheck a boundary in safe code, then call a tiny unsafe block and an extern C function.Locked