Rust#

A systems programming language that guarantees memory safety and thread safety at compile time — without a garbage collector.

Overview#

Rust was created by Graydon Hoare at Mozilla and released in 2015. It solves a problem that plagued systems programming for decades: how to write fast, low-level code without memory bugs (use-after-free, buffer overflows, data races) that are the root cause of ~70% of security vulnerabilities in C/C++ codebases (per Microsoft and Google studies).

Rust achieves this through its ownership system — a set of compile-time rules that ensure memory is always valid, always freed exactly once, and never accessed concurrently without synchronisation. If your code compiles, an entire class of bugs is eliminated.

Rust is used in Firefox, the Linux kernel, Android, AWS (Firecracker, Bottlerocket), Cloudflare, Discord, Figma, and the foundations of many CLI tools (ripgrep, fd, bat, exa). It has been voted “most admired language” on Stack Overflow for years running.

This path assumes you can already program and understand concepts like pointers, stack vs heap, and concurrency. It focuses on what makes Rust unique.

Prerequisites#

  • Comfortable programming in at least one language (C, C++, Go, Java, or similar)
  • Understanding of stack vs heap memory allocation
  • Basic familiarity with command-line tools
  • Willingness to fight the compiler — it will reject code you think is correct, and it will be right

Sections#

#SectionTopics
1Getting StartedInstallation, cargo, project structure, hello world
2Types & VariablesPrimitives, mutability, shadowing, tuples, arrays, type inference
3Ownership & BorrowingThe ownership model, moves, borrows, lifetimes, the borrow checker
4Structs & EnumsStructs, methods, enums, pattern matching, Option, Result
5Error HandlingResult, Option, the ? operator, custom errors, anyhow/thiserror
6Collections & IteratorsVec, HashMap, iterators, closures, iterator adaptors, collect
7Traits & GenericsTraits, trait bounds, generics, associated types, trait objects
8LifetimesLifetime annotations, elision rules, structs with references, ‘static
9ConcurrencyThreads, Send/Sync, Mutex, Arc, channels, async/await, tokio
10Smart Pointers & MemoryBox, Rc, Arc, RefCell, Cow, interior mutability, unsafe
11Modules & CargoModule system, crates, workspaces, features, testing, publishing
12Patterns & EcosystemBuilder, newtype, typestate, serde, clap, tokio, key crates

What Makes Rust Different#

FeatureRust’s ApproachContrast
Memory safetyOwnership + borrow checker (compile-time)GC (Java, Go, Python) or manual (C, C++)
Null safetyNo null — uses Option<T>Null references everywhere else
Error handlingResult<T, E> — no exceptionstry/catch (Java), panic (Go)
Concurrency safetySend/Sync traits — data races impossibleShared mutable state (C++, Java)
Zero-cost abstractionsIterators, generics compile to optimal machine codeVirtual dispatch overhead (Java)
No runtimeNo GC, no VM, no interpreterJVM, Node, Python interpreter
Package managerCargo — build, test, bench, publishMake + manual deps (C), go mod (Go)

Rust Edition#

This path targets Rust 2021 edition (stable since Rust 1.56). Key edition milestones:

EditionNotable Changes
2015Initial stable release
2018Module system overhaul, async/await (1.39), NLL borrow checker
2021Disjoint capture in closures, IntoIterator for arrays, cleaner defaults
2024(In progress) RPIT lifetime capture rules, gen blocks