Lectures

Lecture Slides and Video Recordings

The presentation slides used in these lectures will be posted in this page before the lectures, and may be updated after each lecture is concluded. There are a total of 12 lectures in this course, each two hours.

Introduction to the Course

  • About me
  • Goals and the course structure (4 assignments, 1 project)
  • Course website
  • Textbook
  • Grading policy
  • Advantages of the Rust programming language

Learning Rust the Hands-On Way

  • Reading the errors carefully
  • Installing and using the Rust toolchain
  • Creating, building, and running the first Rust project
  • Implementing a guessing game

Lecture 1 Recording (Part 1)

Lecture 1 Recording (Part 2)

Basic Programming Concepts

  • Mutable and immutable variabls
  • Static types
  • Scalar data types
  • Compound data types
  • Functions
  • If expressions
  • Loops

Ownership and the String Type

  • Ownership: a unique feature in Rust towards memory safety
  • The String type
  • References and borrowing
  • String slices

Lecture 2 Recording (Part 1)

Lecture 2 Recording (Part 2)

Quiz 1 Sample Questions

Quiz 1 Sample Questions — Answer Key

Structs and Enums

  • Defining and instantiating structs
  • Methods
  • Enums
  • Options
  • Pattern matching
  • The power of enums
  • Characteristics of object-oriented languages

Lecture 3 Recording (Part 1)

Lecture 3 Recording (Part 2)

Quiz 1 Questions

Quiz 1 Questions — Answer Key

Quiz 2 Sample Questions

Quiz 2 Sample Questions — Answer Key

Lecture 4 Recording (Part 1)

Lecture 4 Recording (Part 2)

Quiz 2 Questions

Quiz 2 Questions — Answer Key

Error Handling

  • Recoverable and unrecoverable errors
  • Handling unrecoverable errors with panic!
  • Handling recoverable errors with Result
  • To panic! or not to panic!

Quiz 3 Sample Questions

Quiz 3 Sample Questions — Answer Key

Vectors and Hash Maps

  • Storing lists of values in vectors
  • Storing key-value pairs in hash maps

Lecture 5 Recording (Part 1)

Lecture 5 Recording (Part 2)

Sample Midterm Examination 1

Sample Midterm Examination 1 — Answer Key

Sample Midterm Examination 2

Sample Midterm Examination 2 — Answer Key

Sample Midterm Examination 3

Sample Midterm Examination 3 — Answer Key

Quiz 3 Questions

Quiz 3 Questions — Answer Key

Midterm Examination

Midterm Examination — Answer Key

Generics and Traits

  • Generic data types
  • Traits: defining shared behaviour across structs

Lecture 6 Recording (Part 1)

Lecture 6 Recording (Part 2)

Lifetimes

  • Basic concepts of lifetimes
  • Providing hints to the compiler using lifetimes

Quiz 4 Sample Questions, Set 1

Quiz 4 Sample Questions, Set 1 — Answer Key

Quiz 4 Sample Questions, Set 2

Quiz 4 Sample Questions, Set 2 — Answer Key

Quiz 4 Sample Questions, Set 3

Quiz 4 Sample Questions, Set 3 — Answer Key

Quiz 4 Questions

Quiz 4 Questions — Answer Key

Lecture 7 Recording (Part 1)

Lecture 7 Recording (Part 2)

Functional Rust

  • Closures: anonymous functions
  • Processing a collection of items with iterators

Smart Pointers

  • Using Box<T> to allocate memory on the heap
  • Trait objects
  • Dynamically sized types and the Sized trait
  • Wide pointers
  • The Deref trait and deref coercion
  • The Drop trait
  • Rc<T>, the reference-counted smart pointer
  • RefCell<T> and the interior mutability pattern

Lecture 8 Recording (Part 1)

Lecture 8 Recording (Part 2)

Quiz 5 Sample Questions, Set 1

Quiz 5 Sample Questions, Set 1 — Answer Key

Quiz 5 Sample Questions, Set 2

Quiz 5 Sample Questions, Set 2 — Answer Key

Quiz 5 Sample Questions, Set 3

Quiz 5 Sample Questions, Set 3 — Answer Key

Quiz 5 Questions

Quiz 5 — Answer Key

Fearless Concurrency — Threads

  • Multi-threaded programming
  • The actor model
  • Message passing using channels
  • Send + Sync marker Traits
  • Atomic types from the Rust standard library

Lecture 9 Recording (Part 1)

Lecture 9 Recording (Part 2)

Asynchronous Rust

  • Asynchronous Rust with stackless coroutines
  • Asynchronous runtimes
  • Futures and async/.await
  • A real-world example: page_title()
  • Desugaring async and `#[tokio::main]
  • Deep dive: What’s a Future anyway?
  • Pin and the Unpin marker trait
  • What’s a Waker?
  • Spawning and joining tasks