Learning roadmap · 5 stages · about 42 h · up to Gold
Zero to Rust, coming from Python
Five stages from a first compiled program to a tested command-line tool, built around the one idea Python does not have: ownership.
Goal Write a small command-line tool in Rust without following a guide.
Links opened on 13 Nov 2026 · 24 sources: 24 opened and kept
- For self-study
- Starts from a neighbouring field
- 5 h a week
- Start 16 Nov 2026
- Goal date 14 Feb 2027
Stage 1 of 5
First binary
Install the toolchain, compile, and read your first compiler errors.
Step 1 of 3
Install and run
After this step you have a compiler and cargo, and you have seen a program build and run.
Sources
Main source · Documentation
Install Rust · Rust project
The official install page. It installs through rustup, which also brings cargo.
Free · about 10 min · opened 13 Nov 2026
Do
Install with rustup, run cargo new hello, then cargo run. Read the three lines cargo prints.
Key points
- rustup installs the compiler and cargo together; rustc compiles one file, cargo builds whole projects.
- cargo new makes a project, cargo run builds and runs it, cargo check only checks that it compiles.
Step 2 of 3
One whole program
A complete program before any theory: input, a loop, match, one external crate.
Before you open a source
Python lets you rebind any name. What will the Rust compiler say to: let x = 5; x = 6;
Sources
Main source · Book
The Rust Programming Language, chapter 2: Programming a Guessing Game · Rust project
One complete program, typed step by step, that uses cargo new, match and the rand crate.
Free · about 1 h · opened 13 Nov 2026
Do
Type the guessing game yourself, no pasting. Then break it on purpose: remove one mut and read the error.
Check yourself
let x = 5; x = 6; What happens?
Show the answer
Variables are immutable unless declared with let mut. The compiler rejects the second assignment.
Key points
- Variables are immutable by default; add mut to allow reassignment.
- match compares a value against patterns and must cover every case.
- External crates (the guide uses rand) are listed in Cargo.toml and cargo downloads them.
- A compiler error names the line, says what is wrong and often suggests a fix.
Step 3 of 3
Fix twenty small programs
Short broken programs to repair. This is where reading compiler errors becomes routine.
Sources
Main source · Exercises
Rustlings · Rust project
Small exercises for reading and writing Rust. The project itself recommends them alongside the book.
Free · opened 13 Nov 2026
Do
Work through the first Rustlings exercise groups until every one compiles.
Key points
- Read the compiler error from the top before changing code; it usually points at the exact fix.
- Fix Rustlings exercises one at a time until each one compiles and passes.
Signpost at the end of the stage
Base camp
What you can show
- Show a project you created with cargo that builds without warnings.
- Show one compiler error you caused on purpose and explain each line of it.
Camp
Build the guided tool
Follow the guide once, typing everything.
Rungs of the ladder
Climb the ladder: first with the guide, then changed, then your own.
- Guided Build grrs along the tutorial and run it on a file of your own.
For this camp
Book
Command Line Applications in Rust: a command line app in 15 minutes · Rust CLI working group
A guided build of grrs, a small search tool. It is the first rung of the project.
Free · about 1 h · opened 13 Nov 2026
Stage 2 of 5
Ownership and borrowing
The one idea Python does not have. Everything later depends on it.
Step 1 of 4
Who owns the value
In Python two names can share one object. Here a value has one owner, and assignment can move it.
Before you open a source
let a = String::from("hi"); let b = a; println!("{a}"); Does this compile?
Sources
Main source · Book
The Rust Programming Language, chapter 4.1: What Is Ownership? · Rust project
States the ownership rules and shows a move, the exact case in this step's prediction.
Free · about 45 min · opened 13 Nov 2026
Alternative · Book · in German
Die Programmiersprache Rust, Kapitel 4.1 · rust-lang-de
The same chapter in German, for the step where exact wording matters most.
Free · about 45 min · opened 13 Nov 2026
Do
Write the three lines, read the error, then make it compile in two different ways.
Check yourself
The same three lines with let a = 5 compile. Why?
Show the answer
An integer is copied on assignment, so a stays valid. A String is moved, so a is no longer usable.
Key points
- Each value has exactly one owner, and the value is dropped when its owner goes out of scope.
- Assigning a String to another variable moves it; the old variable can no longer be used.
- Integers and other simple types are copied on assignment, so both variables stay valid.
- clone makes a real copy when you need both; it costs time and memory.
Step 2 of 4
Lend, do not give away
References let a function use a value without taking it. The compiler allows one writer or many readers, never both.
Before you open a source
A function takes &String and tries to push to it. Does it compile, and what would change that?
Sources
Main source · Book
The Rust Programming Language, chapter 4.2: References and Borrowing · Rust project
Explains shared and mutable references and the rule that stops two writers, the case in this step's check.
Free · about 40 min · opened 13 Nov 2026
Do
Write one function that reads a String through a reference and one that changes it through a mutable reference. Call each twice from main.
Check yourself
Why can you not hold two mutable references to the same String at once?
Show the answer
Two writers could change the value under each other. The compiler refuses it at build time, so no data race can happen.
Key points
- &T lends read-only access, &mut T lends write access, and the owner keeps the value.
- At one time you may have many shared references or one mutable reference, never both.
- A reference must not outlive the value it points to; the compiler checks this.
Step 3 of 4Side trail
Borrowing, by example
A side trail: short examples of lending a value instead of giving it away.
Sources
Main source · Documentation
Rust By Example: Borrowing · Rust project
Short code examples of borrowing to change and run again.
Free · about 20 min · opened 13 Nov 2026
Do
Run each example, change one line so it fails, and predict the error before you compile.
Key points
- Pass &value to lend and &mut value to lend for changes; the function does not take ownership.
- Borrowing does not move a value: the owner can use it again once the borrow is over.
Step 4 of 4
Move and borrow, twenty times
Repetition is how ownership stops feeling like a rule and starts feeling like a habit.
Sources
Main source · Exercises
Rustlings · Rust project
Small exercises for reading and writing Rust. The project itself recommends them alongside the book.
Free · opened 13 Nov 2026
Do
Continue Rustlings with the exercises that deal with moving and borrowing values. Fix each one without looking up the answer first.
Key points
- On a moved-value error, either borrow with & or clone, depending on whether the caller still needs the value.
- A function that only reads its argument should take a reference, so the caller keeps ownership.
Signpost at the end of the stage
Ownership ridge
What you can show
- Show a function that borrows a String and one that takes ownership, and say which one the caller can still use afterwards.
- Explain a moved-value error to someone who only knows Python.
Camp
Change the tool, then build your own
Same tool, new behaviour, then a tool you pick.
Rungs of the ladder
Climb the ladder: first with the guide, then changed, then your own.
- Changed Add an option that prints the line number in front of every match.
- Your own Build a different tool from the menu, without a guide.
Pick one
- Word counter for text files
- Sum one column of a CSV file
- Batch file renamer
It is done when
- Builds without warnings
- Handles a missing file without a panic
- You can explain every borrow in it
Stage 3 of 5
Structs, enums and errors
Model your data with types, and handle failure with values instead of exceptions.
Step 1 of 4
Your own types
A struct is a Python class without inheritance. Methods live in a separate impl block.
Before you open a source
A Python class bundles data and methods in one block. Where do you think a Rust struct keeps its methods?
Sources
Main source · Book
The Rust Programming Language, chapter 5.1: Defining and Instantiating Structs · Rust project
Shows how to define a struct and create an instance, which is what this step asks you to do.
Free · about 30 min · opened 13 Nov 2026
Do
Define a struct for one line of your tool's output, write a constructor function and one method, and print an instance.
Key points
- A struct groups named fields; its methods go in a separate impl block, not inside the struct.
- Field init shorthand lets you write name instead of name: name when the variable has the same name.
- Struct update syntax (..other) fills the remaining fields from another instance.
- mut applies to the whole instance, not to single fields.
Step 2 of 4
Enums and match
An enum can carry data in each variant. Option replaces None, and match makes you handle every case.
Before you open a source
Python returns None when nothing is found. What would a function that may find nothing return in Rust?
Sources
Main source · Book
The Rust Programming Language, chapter 6.1: Defining an Enum · Rust project
Covers enums with data in their variants and the Option type, which stands in for None.
Free · about 35 min · opened 13 Nov 2026
Do
Write an enum with three variants that carry different data, and a match that handles each. Then delete one arm and read the error.
Check yourself
What does the compiler do when a match leaves out one variant of an enum?
Show the answer
A match must cover every variant. A missing one is a compile error, which is the point of enums.
Key points
- An enum value is exactly one variant, and each variant can carry its own data.
- Option<T> replaces null: a value is Some(x) or None, and you must handle both.
- match must cover every variant; use _ as a catch-all only when you mean it.
Step 3 of 4
Result instead of exceptions
Failure is a value you return. The question mark passes it up, and unwrap is only for code that cannot fail.
Before you open a source
Python raises an exception when a file is missing. How could a function report that without raising?
Sources
Main source · Book
The Rust Programming Language, chapter 9.2: Recoverable Errors with Result · Rust project
Covers Result, unwrap and the question mark operator, the three tools this step uses.
Free · about 45 min · opened 13 Nov 2026
Alternative · Book
Command Line Applications in Rust: Nicer error reporting · Rust CLI working group
Shows error reporting in the tool you are building, using the anyhow crate.
Free · about 25 min · opened 13 Nov 2026
Do
Make your tool return a Result when the file is missing, pass it up with the question mark, and print a readable message in main.
Check yourself
Name one place where unwrap is fine and one where it is not.
Show the answer
Fine in a quick test or when a failure is truly impossible. Not in code that reads user input or files, because a failure would crash the program.
Key points
- Result<T, E> is Ok(value) or Err(error); the caller decides what to do with each.
- The ? operator returns the error early, so it only works in a function that returns a compatible Result.
- unwrap and expect panic on Err; keep them for tests, examples and cases that cannot fail.
- The anyhow crate adds context to errors, for example .with_context(...), for readable messages in a CLI.
Step 4 of 4
Types and errors, in small tasks
Three small exercises that each need a struct, an enum or a Result.
Sources
Main source · Exercises
Rust on Exercism · Exercism
Practice exercises with community solutions to read afterwards. The site says it is free for everyone.
Free · opened 13 Nov 2026
Do
Solve three exercises on the Rust track, choosing ones that use a struct, an enum and a Result. Read one community solution for each afterwards.
Key points
- Start from the types: a struct for related fields, an enum for one-of-several cases, Result for what can fail.
- Read other solutions after yours and compare how they used match, ? and iterators.
Signpost at the end of the stage
Types camp
What you can show
- Show a function that returns a Result and a caller that handles both outcomes.
- Show an enum with data in its variants and a match over it with no catch-all arm.
- Explain in one sentence why Rust has no null.
Camp
Report errors properly
The tool from the last camp should never panic on bad input.
Rungs of the ladder
Climb the ladder: first with the guide, then changed, then your own.
- Changed Give your tool its own error type and an exit code that differs for a missing file and an unreadable one.
Stage 4 of 5
Collections, traits and lifetimes
Store many values, share behaviour between types, and read lifetime annotations without fear.
Step 1 of 4
Vectors and hash maps
Vec is the list you know, HashMap the dict. Both own what they hold, so ownership comes along.
Before you open a source
In Python you can append to a list while looping over it. What will the borrow checker say to that in Rust?
Sources
Main source · Book
The Rust Programming Language, chapter 8.1: Storing Lists of Values with Vectors · Rust project
Explains Vec, including why you cannot push to it while holding a reference into it.
Free · about 30 min · opened 13 Nov 2026
Alternative · Book
The Rust Programming Language, chapter 8.3: Storing Keys with Associated Values in Hash Maps · Rust project
Covers HashMap and how it takes ownership of what you insert, the basis of the word count task.
Free · about 30 min · opened 13 Nov 2026
Do
Count word frequencies in a text file with a HashMap, then sort the result into a Vec and print the top five.
Key points
- Vec<T> is a growable list. v[i] panics when i is out of range; v.get(i) returns an Option instead.
- You cannot push to a Vec while holding a reference to one of its elements; the push may move the data.
- HashMap<K, V> takes ownership of inserted keys and values that are not Copy.
- map.entry(key).or_insert(0) is the usual way to update a count without overwriting it.
Step 2 of 4
Traits: shared behaviour
A trait is like an abstract base class or a protocol: a list of methods a type promises to have.
Before you open a source
How does Python decide that an object can be used as an iterable? What do you expect Rust to ask for instead?
Sources
Main source · Book
The Rust Programming Language, chapter 10.2: Defining Shared Behavior with Traits · Rust project
Defines a trait, implements it for types and passes any such type to a function, the three parts of this step.
Free · about 50 min · opened 13 Nov 2026
Do
Define a trait with one method, implement it for two of your own types, and write one function that accepts any type with that trait.
Check yourself
What must a type do before it can be passed to a function that asks for T: MyTrait?
Show the answer
It must implement MyTrait, in an impl MyTrait for Type block.
Key points
- A trait lists method signatures; a type opts in with impl Trait for Type.
- A function can take impl Trait or a generic T: Trait, so it works for any type that implements it.
- Traits can have default methods that an implementing type may keep or override.
- You may implement a trait for a type only if the trait or the type is defined in your own crate (the orphan rule).
Step 3 of 4
Lifetimes, read slowly
Lifetime annotations do not change how long anything lives. They tell the compiler how references relate.
Before you open a source
A function returns one of two string references. How does the compiler know the result does not outlive either input?
Sources
Main source · Book
The Rust Programming Language, chapter 10.3: Validating References with Lifetimes · Rust project
Builds up lifetime annotations from the borrow checker's error, starting with the longest function.
Free · about 1 h · opened 13 Nov 2026
Do
Write the longest function from the chapter without looking, trigger the missing lifetime error, then fix it with an annotation.
Check yourself
Does writing 'a on a reference make the value live longer?
Show the answer
No. The annotation only describes how the lifetimes of references relate, so the compiler can check them.
Key points
- A lifetime annotation like 'a does not extend a lifetime; it states how the lifetimes of references relate.
- A function that returns a reference must tie it to an input, or the compiler cannot prove the result stays valid.
- Most signatures need no annotations, because of the lifetime elision rules.
- A struct that holds a reference needs a lifetime parameter so it cannot outlive what it borrows.
Step 4 of 4
Collections and traits, in small tasks
Exercises where the type system does half the work once you pick the right types.
Sources
Main source · Exercises
Rust on Exercism · Exercism
Practice exercises with community solutions to read afterwards. The site says it is free for everyone.
Free · opened 13 Nov 2026
Alternative · Exercises
Rustlings · Rust project
Small exercises for reading and writing Rust. The project itself recommends them alongside the book.
Free · opened 13 Nov 2026
Do
Solve three exercises that need a Vec or a HashMap and one that needs you to implement a trait. Refactor one earlier solution to use what you learned.
Key points
- Pick the collection by access pattern: Vec for order and index, HashMap for lookup by key.
- When a function needs behaviour rather than a concrete type, ask for a trait bound.
Signpost at the end of the stage
Trait pass
What you can show
- Show a function that works for two different types through a trait.
- Show a struct that holds a reference, with its lifetime annotation, and say what it prevents.
- Explain when you would pick a HashMap over a Vec.
Stage 5 of 5
Finish the tool
Split the code into modules, test it, use iterators, and ship a tool you chose yourself.
Step 1 of 4
Modules and crates
Split a growing program into files and modules, and pull in a crate for argument parsing.
Sources
Main source · Book
The Rust Programming Language, chapter 7: Packages, Crates, and Modules · Rust project
The official overview of packages, crates and modules for splitting a growing program.
Free · about 40 min · opened 13 Nov 2026
Alternative · Documentation
The Cargo Book: Cargo Guide · Rust project
The official guide to Cargo.toml and dependencies, for adding your first crate.
Free · about 20 min · opened 13 Nov 2026
Do
Move your tool's logic out of main into a library part with at least two modules, keep main thin, and add one dependency to Cargo.toml.
Key points
- A package holds crates; a crate is a tree of modules rooted at main.rs (binary) or lib.rs (library).
- Items are private by default; mark them pub to use them from outside their module.
- Dependencies go under [dependencies] in Cargo.toml, and cargo fetches them on the next build.
- Keep main thin: parse arguments, call a library function, and handle the Result it returns.
Step 2 of 4
Tests you can trust
Unit tests live next to the code, and cargo test runs them all. Test the failure paths too.
Before you open a source
Where would you put the tests for a function in a Python project? Where do you expect Rust to put them?
Sources
Main source · Book
The Rust Programming Language, chapter 11.1: How to Write Tests · Rust project
Shows how to write a test function and use assert_eq!, the macro this step's check asks about.
Free · about 40 min · opened 13 Nov 2026
Alternative · Book
Command Line Applications in Rust: Testing · Rust CLI working group
Tests written for the same kind of tool you are building, including running the program itself.
Free · about 30 min · opened 13 Nov 2026
Do
Write at least five tests for your tool: three for normal input and two for failures. Make one fail on purpose and read the output.
Check yourself
Which macro compares two values in a test and shows both when they differ?
Show the answer
assert_eq! prints the left and right value when they differ. assert! only prints the expression.
Key points
- A test is a function marked #[test]; cargo test runs all of them and reports each as ok or FAILED.
- assert_eq!(left, right) prints both values when they differ; assert! only reports the failed expression.
- Unit tests live in a #[cfg(test)] module in the same file; integration tests live in a tests directory.
- #[should_panic] checks that code panics on bad input; a test can also return a Result.
Step 3 of 4
Iterators
Iterator chains are Rust's list comprehensions: lazy, fast, and checked by the compiler.
Before you open a source
Python's map and filter are lazy. What do you expect Rust to need before an iterator chain produces a value?
Sources
Main source · Book
The Rust Programming Language, chapter 13.2: Processing a Series of Items with Iterators · Rust project
Explains that iterators are lazy and how map, filter and collect chain together.
Free · about 40 min · opened 13 Nov 2026
Do
Rewrite one loop in your tool as an iterator chain with map, filter and collect, and check that the output is unchanged.
Key points
- Iterators are lazy: map and filter do nothing until a consuming method such as collect, sum or a for loop runs them.
- iter() borrows the items, into_iter() takes ownership of them, iter_mut() borrows them mutably.
- collect needs a target type, for example let v: Vec<_> = ... or collect::<Vec<_>>().
Step 4 of 4Side trail
Read someone else's Rust
Reading a small, well-made crate shows how the pieces you learned fit together outside of exercises.
Sources
No checked source
No source could be verified for this step. Search terms that should find one: "small Rust crates to read for beginners", "Rust code reading guide".
Do
Pick a small crate you use, read its main module and tests, and write down three things it does that you would have done differently.
Key points
- Read the tests first: they show what the crate promises and how its functions are meant to be called.
- Start at lib.rs or main.rs and follow one public function down to where it does its work.
Signpost at the end of the stage
Summit camp
What you can show
- Run cargo test on your own tool and show that every test passes.
- Show your tool handling a missing file, a bad option and an empty input without a panic.
- Explain to someone else why you chose the types you did.
Camp
Ship your own tool
A tool you chose, tested, with a readable command line.
Rungs of the ladder
Climb the ladder: first with the guide, then changed, then your own.
- Your own Finish the tool you started at the ownership camp: tests, error handling and a help text, with no guide open.
It is done when
- Builds without warnings
- At least five passing tests
- Never panics on bad input
- You can explain every borrow in it
For this camp
Book
The Rust Programming Language, chapter 12: An I/O Project: Building a Command Line Program · Rust project
A second full command-line program, with modules, errors and tests, to compare with your own design.
Free · about 1.5 h · opened 13 Nov 2026
Reference
clap: API documentation · clap contributors
Reference for the argument-parsing crate, including the derive approach, for the help text of your tool.
Free · opened 13 Nov 2026
Capstone
A command-line tool of your own
One tool that grows at every camp: first built along a guide, then changed, then replaced by one you chose.
The camps of every stage build up to this.