intermediate · No code

Rust Refresher

Rebuild fluency reading Rust code through ownership, borrowing, mutability, collections, iterators, and Result. Progress from core reasoning about values and references to error-aware control flow and integrated code analysis.

What you'll be able to do

  • Trace which variable owns a Rust value, when moves occur, and when the value is dropped.
  • Determine whether shared and mutable borrows are valid by applying Rust's lifetime and aliasing rules.
  • Read Result-based code and identify the value carried by Ok or Err, including the path taken by the ? operator.
  • Follow match-based error handling to determine the valid control-flow outcomes of a Rust function.
  • Analyze a multi-step Rust code path involving ownership, borrowing, Result states, propagation, and explicit error handling.

Who this is for

This course is for learners who have written or studied basic Rust and want to regain fluency reading unfamiliar code. It fits anyone who needs a focused refresher on ownership, borrowing, collections, iterators, and Result-driven control flow.

What you should already know

  • Basic familiarity with Rust syntax, including variables, functions, expressions, and control flow.
  • Some prior exposure to Rust code using String, collections, or functions that return Result.
  • The ability to read short programs and identify the types of their variables at a basic level.

How a lesson actually goes

Lesson 1
TutorWelcome to Rust Refresher. We will focus on reading code by tracing what each value owns, when references are valid, and how Result changes control flow. Before we begin, what usually causes the most uncertainty for you: moves, borrows, or error handling?
YouMoves are the confusing part. I understand that assigning a String to another variable can move it, but I sometimes expect both variables to keep referring to the same text.
TutorThat is a useful distinction to work on. Consider let first = String::from("hi"); let second = first;. The String value has one owner at a time, so after the assignment, which variable should be considered the owner, and what should happen if the code later uses first?
Yousecond is the owner, and using first might fail because the value was moved. I am less sure whether first is destroyed immediately or whether only its ability to access the String changes.
TutorGood: the important event is that ownership transfers and first becomes invalid for using that String. The allocation is not necessarily dropped at the assignment; it is dropped when the current owner, second, goes out of scope. Next, we will compare that move with borrowing, where the original owner remains responsible for the value.

Written from this course's first lesson to show the format — not a recording of a real session.

Course content

marks each module's capstone lesson.

01Ownership Foundations4 lessons

Build a foundation for tracing how Rust values are owned, moved, borrowed, and passed through code. Learners will reason about valid references, ownership changes, and data flow before applying these ideas together.

  • Course Introduction

    Welcome and orientation: overview of the learning path, key outcomes, and how modules build fluency reading Rust code through ownership, borrowing, mutability, collections, iterators, and Result.

  • Ownership

    Ownership gives each value a responsible binding and determines how long that value remains valid. Learners trace scope boundaries and use ownership rules to predict when Rust releases memory.

  • Borrowing

    Borrowing allows code to use a value through a reference without taking ownership. Learners distinguish shared and mutable references and reason about when references can coexist.

  • Ownership and Data Flow Synthesis

    Synthesize ownership and borrowing rules to explain how data flows through bindings, function calls, and nested scopes. Assessment focuses on predicting which expressions compile and why.

02Error-Aware Reading4 lessons

Learn to read Rust code that can succeed or fail by tracing Result values, understanding early error propagation with the ? operator, and analyzing explicit error handling. The module concludes with integrated reasoning about ownership, data flow, and error paths.

  • Result States

    Read Result values as either Ok containing a successful value or Err containing an error. Use the two states to determine what a function may return at a particular point in execution.

  • Error Propagation

    The ? operator continues execution when a Result is Ok and exits the enclosing compatible function when it is Err. Read the surrounding code to determine which statements execute on each path.

  • Result Matching

    A match on Result makes success and failure handling explicit through separate arms. Analyze each arm's returned value, side effects, and resulting type when reading the code.

  • Error-Aware Code Analysis

    Analyze integrated Rust code by following values and references while distinguishing successful and failing paths. Account for how moves, borrows, match arms, and the ? operator affect validity, control flow, and the final result.

Questions

Is this course for someone completely new to Rust?

It is designed as a refresher, not a first introduction. You should already recognize basic Rust syntax and be able to read simple functions; the course then focuses on reasoning about ownership, borrowing, and errors.

Will I write Rust code or mainly analyze it?

The emphasis is on reading and reasoning about Rust code. You will work through focused examples to determine ownership, borrow validity, Result states, and control-flow outcomes rather than follow a large project build.

Does the course cover the borrow checker in detail?

It covers the reasoning needed to determine whether shared and mutable borrows are valid, including lifetimes, aliasing rules, moves, and value validity. It does not attempt to cover every advanced lifetime or trait-system topic.

How much error handling is included?

You will read Result values, distinguish Ok and Err contents, trace the ? operator, and follow match expressions that handle errors. These ideas are combined with ownership and borrowing in the final analysis exercises.

Is this useful if I understand Rust syntax but frequently get confused by ownership?

Yes. The course is organized around tracing values and references through code, so it targets the gap between recognizing Rust syntax and confidently predicting whether a code path is valid.

The first lesson is ten minutes away.

Free while codeset is early. You choose what you're building before the first lesson starts, and the course is taught around it.

Start this course

Other courses