Pages

Topics

Tools

↑↓navigate↵openescclose

Rust guides

Every published Rust guide, newest first, with practical examples you can copy into your own project.

3,815 guides across 14 topics

Topics

Latest Rust guides

3D illustration of future state machines queued for a work-stealing Tokio runtime scheduler with timer wheels
Rust

Rust Async Await: Futures, Pinning, and Tokio Task Execution

An async fn runs nothing until an executor polls it. Await points, Send bounds, blocking in a worker, cancellation and the runtime nesting panic.

RustAsyncTokio
3D illustration of worker thread lanes pushing messages through an mpsc pipe into a receiver guarded by a Mutex
Rust

Rust Concurrency: Spawning Threads, mpsc Channels, and Arc<Mutex<T>>

Ownership rules make data races a compile error. Sharing with Arc<Mutex>, sending with mpsc, and the lock ordering and sender-lifetime mistakes that hang.

RustConcurrencyMultithreading
3D illustration of algebraic enum variants nested in one container beside a struct field grid with method blocks
Rust

Rust Structs and Enums: Tuple Structs, Methods, and Algebraic Data Types

Struct is and, enum is or. Newtypes that stop argument mix-ups, receivers that decide ownership, and state machines where illegal states cannot be built.

RustData StructuresSyntax
3D illustration of a zero-cost iterator chain of map, filter and fold stations reducing a stream to one value
Rust

Rust Iterators and Closures: map, filter, and move Semantics

Iterators are lazy and monomorphised into loops. The three consumption forms, the Fn trait ladder, and why an adapter chain with no consumer does nothing.

RustFunctional ProgrammingIterators
3D illustration of heap Box containers, shared reference-counting rings and a RefCell borrow gate
Rust

Rust Smart Pointers: Box, Rc, Arc, and RefCell with Interior Mutability

Four pointers, four policies: single owner, shared single-thread, shared multi-thread, and a runtime borrow check. The cycles that leak and the panics that bite.

RustMemory ManagementConcurrency
3D illustration of a shared behavior blueprint plugged into several struct shapes through generic bound sockets
Rust

Rust Traits: Defining Interfaces, Default Methods, and Trait Bounds

Static dispatch versus dyn, associated types versus generic parameters, and the object-safety and orphan rules that decide what an API can express.

RustTraitsOOP
3D illustration of a two-track railway where Ok and Some cars continue while Err and None divert at a question-mark switch
Rust

Rust Error Handling: Result, Option, unwrap, and the ? Operator

Errors are values. How ? converts between error types, when unwrap is honest, and the difference between absence and failure that Option erases.

RustError HandlingSyntax
3D illustration of an exhaustive match tree splitting enum variants into guarded branching arms
Rust

Rust Pattern Matching: match Expressions, Guards, and if let Syntax

match is exhaustive and checked; guards are not. Destructuring, bindings with @, slice patterns, and the wildcard arm that quietly breaks when an enum grows.

RustControl FlowPattern Matching
3D illustration of overlapping reference timeline bars bound by glowing scope markers
Rust

Rust Lifetimes Explained: Annotations, Struct References, and Elision

Lifetimes describe relationships, not durations. The three elision rules, what 'static really means, and the two errors no annotation can fix.

RustLifetimesSyntax
3D illustration of a stack frame passing an owned heap pointer while borrow tags attach to the same data block
Rust

Rust Ownership and Borrowing: Move Semantics and Borrow Checker Rules

One owner, either many readers or one writer. How moves differ from Copy, what NLL changed, and the four error codes that cover most borrow failures.

RustOwnershipMemory Safety