Environment: Linux OS.
IDE:
Sessions 1 to 5: Linux Terminal
Sessions 6 to 30: Visual Studio Code (VS Code) + rust-analyzer
Assignments: There would be a session after every session.
Part 1: Environment & Basics (Bridging C to Rust)
Session 1: Welcome to Rust & The Linux Toolchain
Topics: Why Rust? (Safety, Concurrency, Speed vs. C). Installing rustup, cargo, and rustc. Anatomy of a Cargo project. Compiling and running the first program.
Session 2: Variables, Mutability, & Data Types
Topics: let vs mut vs C variables. Scalar types (integers, floats, booleans, chars). Shadowing. Type inference.
Session 3: Functions & Control Flow
Topics: Defining functions, parameters, and return values (expressions vs. statements). if/else expressions, loop, while, and for loops.
Session 4: Ownership - The Core of Rust
Topics: The stack vs. the heap (comparing with C's malloc/free). The rules of ownership. Moving ownership.
Session 5: Borrowing & References
Topics: References (&T), mutable references (&mut T). The Rules of Borrowing (aliasing vs. mutability). The borrow checker in action.
Part 2: Structuring Data & Handling Errors
Session 6: Slices & The String vs. &str Dilemma
Topics: What is a slice? String slices (&str). Array slices. Understanding memory layout of strings.
Session 7: Structs (Beyond C Structs)
Topics: Defining and instantiating structs. Tuple structs. Unit-like structs. Ownership of struct data.
Session 8: Methods & Associated Functions
Topics: The impl block. Methods taking &self, &mut self, or self. Associated functions (constructors).
Session 9: Enums & Pattern Matching
Topics: Defining enums (more powerful than C enums). The Option enum. The match control flow construct.
Session 10: if let & Error Handling with Result
Topics: Concise control flow with if let. Unrecoverable errors (panic!). Recoverable errors with Result.
Session 11: The ? Operator & Propagating Errors
Topics: Simplifying error propagation with ?. Reading a file and parsing its contents, returning errors up the call stack.
Part 3: Collections & Generics
Session 12: Vectors (Vec)
Topics: Dynamic arrays (vs. C arrays). Creating, updating, and dropping vectors. Iterating over vectors.
Session 13: Strings Deep Dive
Topics: Creating and updating strings. Concatenation (+, format!). Indexing (and why it's complex due to UTF-8). Slicing strings safely.
Session 14: Hash Maps
Topics: Key-value stores. Creating, inserting, and accessing values. Updating values based on old values.
Session 15: Generics (Types & Functions)
Topics: Extracting functions. Generic data types (Structs, Enums). Generic methods. Performance (Monomorphization).
Session 16: Traits (Defining Shared Behavior)
Topics: Defining a trait. Implementing a trait on a type. Default implementations. Traits as parameters (Trait bounds).
Session 17: Lifetimes (Validating References)
Topics: The borrow checker's missing piece. Lifetime annotations in function signatures, structs, and methods. Static lifetimes.
Part 4: Advanced Concepts & Concurrency
Session 18: Automated Testing
Topics: Writing tests in Rust. assert!, assert_eq!. Test organization (unit tests vs. integration tests). Using cargo test.
Session 19: Closures
Topics: Anonymous functions. Capturing the environment (Fn, FnMut, FnOnce).
Session 20: Iterators
Topics: The Iterator trait. Consuming adaptors (e.g., sum, collect). Iterator adaptors (e.g., map, filter).
Session 21: Smart Pointers (Box)
Topics: Heap allocation with Box. Recursive types. The Deref trait.
Session 22: Rc & RefCell
Topics: Reference counted smart pointers for multiple ownership. Interior mutability with RefCell. Memory leaks (reference cycles).
Session 23: Fearless Concurrency (Threads)
Topics: Spawning threads with thread::spawn. join handles. Using move closures with threads.
Session 24: Message Passing (Channels)
Topics: Channels (mpsc). Sending and receiving messages between threads.
Session 25: Shared-State Concurrency (Mutexes)
Topics: Mutex. Arc (Atomic Reference Counting). The Send and Sync traits.
Part 5: Systems Programming & Real-World Rust
Session 26: Unsafe Rust (The C Connection)
Topics: When to use unsafe. Dereferencing raw pointers. Calling unsafe functions (FFI - Foreign Function Interface to C).
Session 27: Advanced Traits & Macros
Topics: Associated types. Operator overloading. Declarative macros (macro_rules!).
Session 28: I/O & File Handling
Topics: Reading/writing files efficiently. Command-line arguments (std::env::args). Standard input/output streams.
Session 29: Building a CLI Tool (Project Setup)
Topics: Structuring a larger project. Separating logic from main.rs. Using external crates (e.g., clap for arg parsing).
Session 30: Course Review & Capstone Kickoff
Topics: Review of key concepts (Ownership, Lifetimes, Concurrency). Best practices and idiomatic Rust. Final Q&A.