Lecture 1 / 12
Lecture 01 ยท Fundamentals

Introduction to Rust & Setup

Beginner ~50 min

What is Rust?

Rust is a modern systems programming language focused on performance, memory safety, and thread safety without a garbage collector. It is loved by developers for its powerful ownership system that prevents many bugs at compile time.

Why Rust?

  • Zero-cost abstractions
  • Memory safety without garbage collection
  • Excellent concurrency support
  • Growing ecosystem (web, CLI, embedded, WASM)

Installation

Use rustup โ€” the official Rust toolchain installer.

terminal
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
rustc --version
cargo --version

Your First Rust Program

main.rs
fn main() {
    println!("Hello, Rust Mastery!");
    println!("Welcome to safe systems programming!");
}
Output
Hello, Rust Mastery!
Welcome to safe systems programming!
๐ŸŽฏ Exercise 1.1

Run cargo new hello_rust, then modify src/main.rs to print your name and compile/run it with cargo run.

Lecture 02 ยท Fundamentals

Variables & Ownership

Beginner ~45 min

Immutability by Default

In Rust, variables are immutable by default. Use mut to make them mutable.

let x = 5;
// x = 6; // Error!
let mut y = 10;
y = 11; // OK

Introduction to Ownership

Each value in Rust has a variable that's called its owner. When the owner goes out of scope, the value is dropped.

Lecture 03 ยท Fundamentals

Data Types & Functions

Beginner ~50 min

Scalar & Compound Types

  • Integers: i32, u32, i64, etc.
  • Floating-point: f32, f64
  • Boolean: bool
  • Tuple: (i32, f64, u8)
Lecture 04 ยท Fundamentals

Control Flow

Beginner ~40 min

If Expressions

let condition = true;
let number = if condition { 5 } else { 6 };
Lecture 05 ยท Fundamentals

Loops & Iterators

Beginner ~45 min

Looping with 'for'

for i in 1..=5 {
    println!("{}", i);
}
Lecture 06 ยท Core Concepts

Ownership & Borrowing

Intermediate ~65 min

References & Borrowing

Instead of transferring ownership, you can "borrow" a value using references (&).

fn calculate_length(s: &String) -> usize {
    s.len()
}
Lecture 07 ยท Core Concepts

Structs & Enums

Intermediate ~60 min

Pattern Matching

match some_option {
    Some(i) => println!("{}", i),
    None => println!("None"),
}
Lecture 08 ยท Core Concepts

Collections & Strings

Intermediate ~50 min

Vectors (Dynamic Arrays)

let mut v = vec![1, 2, 3];
v.push(4);
Lecture 09 ยท Advanced

Error Handling

Advanced ~60 min

Panic vs Result

Rust groups errors into two categories: recoverable (Result<T, E>) and unrecoverable (panic!).

Lecture 10 ยท Advanced

Modules & Crates

Intermediate ~45 min

Cargo is Rust's build system and package manager. Use Cargo.toml to manage dependencies.

Lecture 11 ยท Advanced

Traits & Generics

Advanced ~65 min

Defining Shared Behavior

pub trait Summary {
    fn summarize(&self) -> String;
}
Lecture 12 ยท Capstone

Capstone Project: Secure CLI

Advanced ~180 min

Create a Command Line Interface (CLI) tool that securely manages passwords or encrypts files using crates like clap and rust-crypto.

// Project goals:
// 1. Parse CLI arguments
// 2. Handle file I/O safely
// 3. Implement robust error handling
// 4. Use traits for polymorphic output