Flashcard Deck · 20 cards · Public

Rust Systems Programming - Ownership, Lifetimes & Concurrency

Master memory safety, lifetime annotations, smart pointers, and fear-free concurrency in Rust with this comprehensive high-yield flashcard deck.

Cards in this deck

(20 cards)

Preview terms and definitions before starting your study session.

#1
Term
Three Core Rules of Ownership
Definition
1. Each value in Rust has an owner variable.
2. There can only be one owner at a time.
3. When the owner goes out of scope, the value is automatically dropped.
#2
Term
Move Semantics vs. Copy Trait
Definition
Types without Copy transfer ownership on assignment or function call (move), invalidating the original variable. Types implementing Copy (like i32, bool, f64) duplicate via bitwise copy, leaving the original valid.
#3
Term
Aliasing XOR Mutability Rule
Definition
At any given point in execution, data can have either:
  • Unlimited immutable references (&T), OR
  • Exactly one mutable reference (&mut T).
They can never coexist in the same scope to eliminate data races at compile time.
#4
Term
Non-Lexical Lifetimes (NLL)
Definition
The Rust borrow checker feature where a reference's lifetime ends at its last point of use, rather than at the end of its enclosing scope block.
#5
Term
Purpose of Lifetime Annotations ('a)
Definition
Explicit parameters declared in function or struct signatures that describe relationships between reference lifetimes to help the borrow checker validate memory safety. They do not alter runtime lifetimes.
#6
Term
Lifetime Elision Rules
Definition
Compiler heuristics that automatically assign lifetimes without explicit syntax:
1. Each input reference parameter gets its own lifetime.
2. If there is exactly one input lifetime, it is assigned to all output lifetimes.
3. If one input is &self or &mut self, its lifetime is assigned to all output lifetimes.
#7
Term
Static Lifetime ('static)
Definition
Indicates that references can live for the entire duration of the program execution (e.g., hardcoded string literals &'static str) or that a type contains no non-static references.
#8
Term
Option<T> Enum
Definition
Rust's standard type for handling optional values without null pointers:
rust4 lines
enum Option<T> {
    Some(T),
    None,
}
Showing 8 of 20 cards in this deck.
Study All Now

Related Flashcard Sets

Explore similar study materials created by the community

Browse community decks