An original Rust curriculum, from first principles — why Rust, the Cargo toolchain, types and immutability, and the ownership trio (ownership, borrowing, lifetimes) that gives memory safety without a garbage collector, plus structs, enums, pattern matching, and error handling. The Rust companion to the Go and Python curricula.
Rust makes a promise that sounds impossible: memory safety without a garbage collector, and fearless concurrency without data races — all checked at compile time, with no runtime cost. The price is a compiler that argues with you until your program is correct. Understanding that bargain is the key to understanding why Rust exists and why people love it.
Rust makes a promise that sounds impossible: memory safety without a garbage collector, and fearless concurrency without data races — all checked at compile time, with no runtime cost. The price is a compiler that argues with you until your program is correct.
Rust's tooling is one of its quiet superpowers — a single tool, Cargo, handles building, dependencies, testing, and more, and it's good enough that Rust developers rarely think about build systems at all. Before the language's hard ideas, meet the tooling that makes working in Rust pleasant.
Rust's tooling is a quiet superpower — a single tool, Cargo, handles building, dependencies, testing, and more, and it's good enough that Rust developers rarely think about build systems at all. Meet the tooling that makes working in Rust pleasant.
In most languages, variables vary — that's the default, and you opt into constancy. Rust flips it: variables are immutable unless you say otherwise. That one inverted default, plus a strong static type system with inference, quietly shapes how Rust code is written and prevents a whole class of bugs before you meet ownership.
In most languages variables vary by default; Rust flips it — variables are immutable unless you say otherwise. That one inverted default, plus a strong static type system with inference, quietly shapes how Rust is written and prevents a class of bugs.
Ownership is the idea that makes Rust Rust — the mechanism that delivers memory safety without a garbage collector. It's a set of three simple rules with deep consequences, and it's the one concept you must genuinely understand, because everything distinctive about the language flows from it. This is the heart of the series.
Ownership is the idea that makes Rust Rust — the mechanism that delivers memory safety without a garbage collector. Three simple rules with deep consequences, and the one concept you must genuinely understand, because everything distinctive flows from it.
If ownership were the whole story, Rust would be exhausting — you'd move values in and out of every function by hand. Borrowing is the release valve: it lets code use a value without taking ownership, governed by one elegant rule that also happens to eliminate data races. Ownership makes Rust safe; borrowing makes it usable.
If ownership were the whole story, Rust would be exhausting. Borrowing is the release valve: it lets code use a value without taking ownership, governed by one elegant rule that also happens to eliminate data races. Ownership makes Rust safe; borrowing makes it usable.
Lifetimes are the part of Rust that looks most alien — those `'a` annotations scattered through function signatures — and the part most misunderstood. They don't change how your code runs; they're just the compiler making explicit a question it's always been asking: how long does this reference need to be valid? Understanding that reframes lifetimes from cryptic syntax to a natural extension of borrowing.
Lifetimes are the part of Rust that looks most alien and is most misunderstood. They don't change how your code runs — they're the compiler making explicit a question it always asks: how long does this reference need to be valid?
Rust's enums are not the feeble named-constants of other languages — they're full algebraic data types that can hold data, and combined with pattern matching they become one of Rust's most loved features. Together with structs, they're how you model your domain, and the compiler makes sure you handle every case.
Rust's enums are not the feeble named-constants of other languages — they're full algebraic data types that hold data, and combined with pattern matching they become one of Rust's most loved features. Together with structs, they're how you model your domain.
Rust has no exceptions. Errors and absent values are ordinary data — enum values you must handle — so the compiler forces you to deal with the possibility of failure instead of letting it propagate invisibly. It sounds tedious and turns out to be one of Rust's quiet strengths: you cannot forget to handle an error.
Rust has no exceptions. Errors and absent values are ordinary data — enum values you must handle — so the compiler forces you to deal with failure instead of letting it propagate invisibly. It turns out to be one of Rust's quiet strengths.
Module 1's arrays and tuples were fixed-size and stack-bound. Real programs need growable, heap-backed collections — and Rust's three workhorses, Vec, String, and HashMap, are where ownership and borrowing stop being abstract rules and become the everyday texture of writing Rust. This opens Module 2: the data structures and abstractions you actually build with.
Real programs need growable, heap-backed collections — and Rust's three workhorses, Vec, String, and HashMap, are where ownership and borrowing stop being abstract rules and become the everyday texture of writing Rust.
Writing the same function three times for three types is the kind of duplication that rots a codebase. Generics let you write it once, over any type — and Rust's twist is that this abstraction costs nothing at runtime, because the compiler generates the specialized versions for you. Zero-cost abstraction starts here.
Writing the same function three times for three types is duplication that rots a codebase. Generics let you write it once over any type — and Rust's twist is that this abstraction costs nothing at runtime, because the compiler generates the specialized versions.
Traits are Rust's answer to "how do I say that different types share a capability?" — its version of interfaces, but more powerful. They're the mechanism behind generics, operator overloading, iterators, and much of the standard library. If ownership is the heart of Rust's safety, traits are the heart of its abstraction.
Traits are Rust's answer to 'how do I say that different types share a capability?' — its version of interfaces, but more powerful. They power generics, operator overloading, iterators, and much of the standard library. If ownership is Rust's safety heart, traits are its abstraction heart.
Generics with trait bounds give you many types, resolved at compile time. But sometimes you need a collection of different types that share a trait — a list of shapes, a set of plugins — decided at runtime. Trait objects provide that, trading a little performance for runtime flexibility. Knowing when to use which is a real Rust design decision.
Generics with trait bounds give many types resolved at compile time. But sometimes you need a collection of different types that share a trait, decided at runtime. Trait objects provide that, trading a little performance for runtime flexibility.
Closures are anonymous functions that can capture variables from around them — and in Rust, the ownership model makes "capture" a precise, three-way question: does the closure borrow, mutably borrow, or take ownership of what it captures? Understanding that is what makes closures (and the iterators that depend on them) click.
Closures are anonymous functions that capture variables from around them — and in Rust the ownership model makes 'capture' a precise, three-way question: does the closure borrow, mutably borrow, or take ownership of what it captures?
Iterators are how Rust does loops without writing loops — a chain of composable adapters (map, filter, collect) that reads like a description of what you want, not how to get it. And the astonishing part is that this high-level, functional style compiles to code as fast as a hand-written loop. Zero-cost abstraction, at its most delightful.
Iterators are how Rust does loops without writing loops — a chain of composable adapters (map, filter, collect) that reads like a description of what you want. And the astonishing part is that this high-level style compiles to code as fast as a hand-written loop.
Module 1's ownership rules — one owner, borrow-checked references — cover most code. But some data structures genuinely need more: a value on the heap, shared ownership, or mutation through a shared reference. Smart pointers are Rust's escape hatches that provide these while keeping the safety, and knowing the big three is knowing how to model the shapes ownership alone can't.
Ownership's rules cover most code. But some data structures genuinely need more: a value on the heap, shared ownership, or mutation through a shared reference. Smart pointers are Rust's escape hatches that provide these while keeping the safety.
As a program grows past one file, you need a way to organize it — to group related code, control what's public, and pull in libraries. Rust's module system does this with a clear hierarchy and privacy-by-default, and understanding crates, modules, and paths is what lets your projects scale beyond a single main.rs. This closes Module 2.
As a program grows past one file, you need a way to organize it — to group related code, control what's public, and pull in libraries. Rust's module system does this with a clear hierarchy and privacy-by-default.
This series is part of a larger body of work by Pratik Dhanave, an Agentic AI Architect writing about production AI systems, distributed systems, and cloud-native engineering. Explore all course series, browse every post, or find topics via the tag index.