This course is currently under maintenance. We're updating content and labs. Enrollment is paused; check back soon.
AI Instructor Live Labs Included

Programming Foundations with Rust

Learn programming from scratch using Rust. Install the toolchain, write Cargo programs, use Vec and HashMap, handle errors with Result and Option, and read real Rust code. No prior programming experience required.

Beginner
11h 15m
11 Lessons
SMU-RUST-100
Programming Foundations with Rust Badge

View badge details

About This Course

Learn programming from scratch using Rust as your first language. You start with variables, control flow, and functions; move into structs, enums, pattern matching, and error handling with Result and Option; and get your first look at Rust's ownership model. By the end you can read and write small Rust programs a converter, a guessing game, a word-frequency counter, a todo list and you've internalized value-vs-reference semantics in the context where they are natural rather than as a correction to habits built in another language.By the end of this course you will be able to install the Rust toolchain, write and run a small program with Cargo, use the standard-library collections (Vec, HashMap), handle fallible operations with Result and Option, define your own types with struct and enum, and read idiomatic beginner-level Rust code from the ecosystem.No prior programming experience required. Follows the current Rust 2024 edition on stable Rust 1.99.

Course Curriculum

11 Lessons
01
AI Lesson
AI Lesson

Rust in 2026 and the toolchain

45m

Learn what Rust is, why it's trusted in production in 2026, and how its toolchain fits together. You'll explore where Rust sits in the language landscape (memory safety with C/C++ performance, no garbage collector), name real production systems that ship Rust today, understand what rustup, rustc, and cargo each do, and build and run your first Rust program with Cargo.

By the end of this lesson you will be able to describe Rust's value proposition in one sentence, identify the three core toolchain pieces, and create a working Rust project from scratch with cargo new and cargo run.

The first lesson of Course 1 (Programming Foundations with Rust) and the Programming with Rust skill path. Your Rust toolchain is already installed in this lab environment — Hollis Brennan, your recurring Rust mentor across all seven foundational courses, will walk you through what each piece does.

02
AI Lesson
AI Lesson

Values, types, and variables

1h 0m

Learn how Rust represents data at the type-system level. You meet Rust's primitive numeric types (i32, u64, f64, bool, char, usize), see the two string types (String and &str) and when each is right, declare variables with let, let mut, and const, understand shadowing, and read type annotations and compiler-inferred types. By the end you can read any beginner-level Rust snippet and reason about what each binding holds and whether it can change.

03
AI Lesson
AI Lesson

Control flow — if, loop, while, for, match

1h 0m

Learn how Rust turns branching into typed values. You'll use if and else as expressions that bind directly to let, pick the right loop construct (loop, while, for) for each shape of iteration, and reach for match whenever a value falls into named cases — all the while leaning on the compiler to catch the two most common Beginner mistakes (silent-semicolon in an arm, non-exhaustive branch coverage).

By the end of this lesson you will be able to write Rust branching code that produces values rather than mutates them, choose a loop construct deliberately rather than by habit, and apply match on literal values, ranges, guards, and the _ catchall. Prepares you for Lesson 7 (pattern matching on enums and destructuring) and for every exercise from Lesson 5 (Fahrenheit converter) onward.

No prior programming experience required. Builds directly on Lesson 2 (values, types, variables).

04
AI Lesson
AI Lesson

Functions and expression-oriented syntax

45m

Learn how Rust functions are declared, how parameters and return types fit together, and how Rust's expression-oriented syntax lets a function body's last expression become its return value with no explicit return keyword. You will see the classic beginner trip where a stray semicolon converts a value into unit () and silently breaks a function, name the three common return shapes (single value, tuple, unit), and read your first recursive function.

By the end of this lesson you will be able to declare Rust functions with typed parameters, choose between implicit last-expression return and explicit early return, pick an appropriate return shape (single value, tuple, or unit) for a given situation, and trace a small recursive call stack. This lesson is the last of the pure-syntax foundations before Lesson 5's first hands-on lab.

05
Lab Exercise
Lab Exercise

Build a Fahrenheit/Celsius converter CLI - Lab Exercises

1h 0m 5 Exercises

Write your first real Rust program — a small command-line converter that turns Fahrenheit into Celsius and back. Across the exercises you grow an empty main() into a working CLI: declare functions with typed signatures, use match on a direction argument, read values from std::env::args(), and handle parse errors with .expect(). By the end of the lab you can run cargo run -- f_to_c 72 and see a correctly converted value, exercising every concept covered in Lessons 1–4.

06
AI Lesson
AI Lesson

Collections — Vec and HashMap

1h 0m

The two Rust collections you will reach for every day: Vec for ordered sequences and HashMap for keyed lookups. You will learn when to pick each, the operations each supports, how to iterate them safely, and the idiomatic .entry().or_insert() pattern that cuts a two-step insert-or-update into one.

By the end of this lesson you will be able to pick Vec or HashMap for a given data shape, apply their common APIs (push/pop/len/iterate for Vec; insert/get/remove/iterate for HashMap), and use the entry API to update values in place.

07
AI Lesson
AI Lesson

Pattern matching — Option, match on enums, destructuring

1h 15m

Pattern matching is the backbone of safe Rust: it is how you work with values that might be absent, how you take apart compound data without reaching for null checks, and how you make the compiler verify you have covered every case. This lesson introduces Option, the match statement on enum variants, the one-arm shortcuts (if let and while let), and destructuring with guards. By the end you can write functions that never crash on a missing value and read match expressions in real Rust code.

By the end of this lesson you will be able to explain when Option is the right return type, use match to safely extract values from Some, choose between match / if let / while let for a given shape, and destructure tuples and structs in match arms with guards that filter on bound values.

08
AI Lesson
AI Lesson

Error handling — panic, Result, Option, ?

1h 15m

Rust's error-handling story in one lesson: when to panic, when to return Result<T, E>, how ? compresses the plumbing, and where Option fits alongside Result. By the end you can read any Rust function signature that returns Result, follow the control flow of ?, and make a defensible call between .unwrap(), .expect(..), matching, and ? in your own code.

By the end of this lesson you will be able to decide when panic! is appropriate, choose between .unwrap() / .expect() / ? / match for a given failure case, and read Rust code that mixes Option and Result without second-guessing the control flow.

Hollis Brennan walks you through four topics: when panic is the right answer, Result as Option's sibling with context, the .unwrap() crutch versus the ? and match alternatives, and finally the desugaring of ? plus a one-paragraph intro to From conversions you'll meet again in Course 3.

09
AI Lesson
AI Lesson

Structs, methods, derived traits

1h 15m

Build the first type you own. In this lesson you move from calling other people's data (Vec, HashMap, Option) into shaping your own: define a struct, give it methods via impl, derive the traits that let you print, clone, and compare it, and finish with the builder pattern that most crates reach for when a type needs many optional fields.

By the end you can declare a struct, write methods against it with the right receiver choice (&self, &mut self, or self), use #[derive(Debug, Clone, PartialEq)] to get three everyday capabilities for free, and recognize when a builder is worth the extra code vs when a plain struct literal is clearer.

10
AI Lesson
AI Lesson

Introducing ownership (gentle)

1h 0m

Rust's ownership model is the one feature with no close analog in Python, JavaScript, Java, or Go — so this gentle introduction walks through why it exists before showing how it works. You see the three alternatives (manual malloc/free, garbage collection, reference counting) side by side with Rust's compile-time ownership checker, then learn what happens when a value is "moved" from one variable to another and why Copy types behave differently. You finish by tying it back to the receiver types you already saw on struct methods in Lesson 11.

By the end of this lesson you will be able to explain, in your own words, why Rust uses compile-time ownership instead of a garbage collector; predict what the Rust compiler will say when a non-Copy value is reassigned; and pick the right receiver type (&self, &mut self, self) for a method based on what the method actually does. The full ownership story — lifetimes, borrow-checker deep dives, references in function signatures, slices — is reserved for Course 2.

11
AI Lesson
AI Lesson

Modules, crates, and reading real code

1h 0m

Finish the first teaching arc of Programming Foundations with Rust by learning how real projects are organized: modules and visibility (mod, pub, use), crates and the Cargo ecosystem (binary vs library, crates.io, semver), and a capstone walk-through of a real file from the ripgrep project where you tag every construct back to the lesson that taught it.

By the end of this lesson you will be able to explain how Rust finds module files on disk, differentiate binary crates from library crates and describe how Cargo versions dependencies via semver, and read a small Rust file from a shipping open-source project and identify which language features it uses.

Prepares you for Lesson 14 (the capstone todo-list build) and the full ownership deep-dive in Course 2.

Under Maintenance

This course is currently being updated. Check back soon!

This course includes:

  • 24/7 AI Instructor Support
  • Live Lab Environments
  • 1 Hands-on Lessons
  • Completion Badge
Programming Foundations with Rust Badge

Earn Your Badge

Complete all lessons to unlock the Programming Foundations with Rust achievement badge.

Skill Level Beginner
Total Duration 11h 15m
Programming Foundations with Rust Badge
Achievement Badge

Programming Foundations with Rust

Awarded for completing the Programming Foundations with Rust course. Demonstrates ability to install the Rust toolchain, write and run Cargo programs, use Vec and HashMap, handle fallible operations with Result and Option, define custom types with struct and enum, and read idiomatic beginner-level Rust code.

Course Programming Foundations with Rust
Criteria Complete all lessons in the course with assessment scores of 80% or above and submit the final capstone lab (read-through of ripgrep's walker module).

Skills You'll Earn

Rust Cargo Rust 2024 edition Rust standard library Programming fundamentals Error handling with Result and Option Pattern matching Struct and enum design

Complete all lessons in this course to earn this badge