🚀 Launch Special: $29/mo for life --d --h --m --s Claim Your Price →

Rust Fundamentals

The Rust Fundamentals course teaches developers core concepts such as ownership, borrowing, pattern matching, structs, enums, error handling, traits, and generics, enabling them to write safe, efficient code in Rust.

Who Should Take This

It is ideal for software engineers, backend developers, or computer science graduates who have programming experience in languages like C, C++, or Java and want to transition to Rust for system-level projects. Learners seek to master Rust’s safety guarantees and expressive type system without diving into async or unsafe code.

What's Included in AccelaStudy® AI

Adaptive Knowledge Graph
Practice Questions
Lesson Modules
Console Simulator Labs
Exam Tips & Strategy
20 Activity Formats

Course Outline

60 learning goals
1 Ownership & Borrowing
3 topics

Ownership rules

  • Describe the three ownership rules: each value has exactly one owner, only one owner at a time, and the value is dropped when the owner goes out of scope.
  • Explain move semantics for heap-allocated types (String, Vec) versus copy semantics for stack-allocated types that implement the Copy trait.
  • Implement the Clone trait on custom types and explain the difference between a shallow copy (Copy) and a deep copy (Clone).
  • Analyze ownership transfer scenarios to predict when values are moved, copied, or dropped, and identify use-after-move compiler errors.

Borrowing and references

  • Describe shared references (&T) and mutable references (&mut T) and explain the borrowing rules: multiple shared OR one mutable, never both simultaneously.
  • Implement functions that borrow parameters by shared and mutable reference to read and modify data without taking ownership.
  • Describe the rules for reference lifetimes within scopes and explain how non-lexical lifetimes (NLL) allow references to end before the end of their enclosing block.
  • Analyze borrow checker errors involving simultaneous mutable and shared borrows and determine restructuring strategies to satisfy the borrow rules.

Lifetimes

  • Describe lifetime annotations ('a) on function signatures and explain how they connect the lifetimes of input and output references.
  • Explain the three lifetime elision rules and identify when explicit lifetime annotations are required versus when the compiler can infer them.
  • Implement functions and structs with explicit lifetime parameters to hold references and return borrowed data safely.
  • Analyze lifetime conflicts in structs that hold references and determine whether to use owned data, Cow, or explicit lifetime bounds.
2 Types & Pattern Matching
2 topics

Scalar and compound types

  • Identify Rust scalar types (i8-i128, u8-u128, f32, f64, bool, char) and compound types (tuples, fixed-size arrays) and describe their memory representation.
  • Implement type aliases with the type keyword and describe how the newtype pattern (struct Meters(f64)) creates distinct types from existing ones.
  • Explain the difference between String and &str, and between Vec and &[T] slices, including ownership and borrowing implications.
  • Implement type conversions using From, Into, AsRef, and as keyword casting and describe when each conversion mechanism is appropriate.

Pattern matching

  • Describe match expressions with exhaustive pattern matching and explain how the compiler enforces that all possible values are handled.
  • Implement pattern matching with destructuring of tuples, structs, and enums, including nested patterns and the _ wildcard.
  • Implement if let and while let for concise single-pattern matching and explain when they improve readability over full match expressions.
  • Implement match guards (if conditions), binding with @, and the or pattern (|) to handle complex matching scenarios.
3 Structs & Enums
3 topics

Struct types

  • Describe named structs, tuple structs, and unit structs, and explain field visibility (pub) and the struct update syntax (..).
  • Implement methods and associated functions in impl blocks, including the self, &self, and &mut self receiver patterns.
  • Implement the derive attribute for Debug, Clone, PartialEq, Eq, Hash, and Default to auto-generate trait implementations.

Enum types

  • Describe enums with unit variants, tuple variants, and struct variants, and explain how enums model sum types (tagged unions).
  • Implement enums with data-carrying variants and methods in impl blocks to model state machines and algebraic data types.
  • Compare enums versus trait objects for modeling polymorphic behavior and analyze the trade-offs in extensibility, performance, and type safety.

Modules and visibility

  • Describe the module system with mod, pub, pub(crate), and pub(super) and explain how modules organize code into hierarchical namespaces.
  • Implement use statements with aliasing (as), glob imports, and re-exports (pub use) to manage module paths and public APIs.
  • Analyze module visibility boundaries to determine which items are accessible from external crates, sibling modules, and child modules.
4 Error Handling
3 topics

Option and Result types

  • Describe Option (Some/None) and Result (Ok/Err) as the primary error handling types and explain why Rust avoids null and exceptions.
  • Implement pattern matching on Option and Result to handle success and error cases, using unwrap, expect, unwrap_or, and unwrap_or_else.
  • Implement combinator chains on Option and Result (map, and_then, or_else, ok_or) to transform values without explicit matching.

The ? operator and propagation

  • Explain the ? operator for early return of errors and how it automatically converts error types using the From trait.
  • Implement functions that use the ? operator to propagate errors through multiple fallible operations and return Result types.
  • Analyze error propagation paths to determine when to use ?, when to handle errors locally, and when to map errors to different types.

Custom error types

  • Implement custom error enums that implement the std::error::Error and Display traits to represent domain-specific failure modes.
  • Implement From conversions between error types to enable automatic error type conversion with the ? operator across module boundaries.
  • Compare custom error enums versus Box versus anyhow/thiserror approaches and evaluate the trade-offs in type safety, ergonomics, and library versus application code.
5 Traits & Generics
3 topics

Defining and implementing traits

  • Describe traits as shared behavior contracts and explain trait definition syntax including default method implementations.
  • Implement custom traits on structs and enums, including traits with associated types and multiple trait implementations on the same type.
  • Describe the common standard library traits (Display, Debug, Default, From, Into, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash) and their purposes.

Trait bounds and generics

  • Implement generic functions and structs with type parameters and describe how monomorphization produces specialized code at compile time.
  • Implement trait bounds using both the bound syntax (T: Trait) and the where clause to constrain generic type parameters.
  • Implement trait objects (Box, &dyn Trait) for dynamic dispatch and explain the performance trade-off between static dispatch (generics) and dynamic dispatch (dyn).
  • Analyze trait bound requirements to determine the minimal set of bounds needed for a generic function and evaluate when trait objects are preferable to generics.

Blanket implementations and supertraits

  • Describe blanket implementations (impl TraitB for T) and explain how the standard library uses them for automatic trait provision.
  • Implement supertraits (trait B: A) to require that types implementing one trait also implement another.
  • Evaluate trait design decisions including when to use associated types versus generic parameters and when supertraits create appropriate coupling.
6 Collections & Iterators
3 topics

Standard collections

  • Describe Vec, HashMap, HashSet, BTreeMap, and VecDeque and their performance characteristics for common operations.
  • Implement Vec operations (push, pop, insert, remove, extend, retain) and explain capacity versus length and when to use Vec::with_capacity.
  • Implement HashMap operations (insert, get, entry API, or_insert, or_insert_with) and explain ownership semantics when inserting and retrieving values.
  • Compare Vec, HashMap, BTreeMap, and HashSet to select the appropriate collection based on ordering, uniqueness, lookup performance, and memory layout requirements.

Iterator trait and combinators

  • Describe the Iterator trait with its next() method and explain lazy evaluation where iterator adapters produce no work until a consuming adapter is called.
  • Implement iterator chains using map, filter, enumerate, zip, take, skip, and chain to transform and combine data sequences.
  • Implement consuming adapters (collect, fold, sum, any, all, find, position) to produce final values from iterator chains.
  • Implement the Iterator trait on a custom struct to make it iterable with for loops and compatible with standard iterator combinators.
  • Analyze iterator chain performance to explain why iterator combinators compile to the same machine code as hand-written loops due to zero-cost abstractions.

Closures

  • Describe closure syntax (|args| body), closure type inference, and the three closure traits (Fn, FnMut, FnOnce) based on how the closure captures its environment.
  • Implement closures that capture variables by reference, by mutable reference, and by value (move closures) and pass them to higher-order functions.
  • Analyze closure capture behavior to predict which closure trait (Fn, FnMut, FnOnce) the compiler infers and determine when the move keyword is required.

Hands-On Labs

15 labs ~385 min total Console Simulator

Practice in a simulated cloud console or Python code sandbox — no account needed. Each lab runs entirely in your browser.

Scope

Included Topics

  • Ownership system: move semantics, borrowing (&T and &mut T), lifetimes, the borrow checker, and the Copy and Clone traits.
  • Type system: scalar types, compound types (tuples, arrays), type aliases, type inference, and pattern matching with match, if let, and while let.
  • Structs (named, tuple, unit), enums with data variants, impl blocks, associated functions, and methods.
  • Error handling with Result and Option, the ? operator, unwrap/expect, and custom error types.
  • Traits: defining traits, implementing traits, trait bounds, trait objects (dyn Trait), blanket implementations, and common standard library traits (Display, Debug, From, Into, Iterator).
  • Collections (Vec, HashMap, HashSet, String) and the Iterator trait with combinators (map, filter, fold, collect, enumerate, zip).

Not Covered

  • Async/await, futures, and async runtimes (tokio, async-std).
  • Unsafe Rust, raw pointers, and FFI (Foreign Function Interface).
  • Procedural macros, attribute macros, and derive macro implementation (basic derive usage is included).
  • Embedded systems, no_std environments, and bare-metal Rust.
  • Advanced lifetime annotations beyond function signatures (higher-ranked trait bounds, lifetime variance).
  • Cargo workspace management, publishing crates, and build scripts beyond basic cargo commands.

Ready to master Rust Fundamentals?

Adaptive learning that maps your knowledge and closes your gaps.

Subscribe to Access