GUIDES

Module guides for the Rust standard library

Long-form, opinionated walkthroughs of every important module in std. Each guide explains what the module is for, the tradeoffs between its types, and the patterns experienced Rust developers actually use.

std::collections

Six data structures cover almost every general-purpose container need in Rust. Pick the one whose performance shape matches your w

95 items · 6 sections
std::iter

The Iterator trait is the single most important abstraction in std after ownership. Master it and most data-processing code become

60 items · 5 sections
std::io

Two traits, Read and Write, generalise every byte stream in the language. Everything else in io is built on top.

46 items · 5 sections
std::fs

Synchronous, cross-platform access to the file system. For async file I/O reach for tokio::fs or async-fs.

33 items · 5 sections
std::sync

Mutex, RwLock, Arc, OnceLock, channels, and atomics — everything you need for safe shared-state concurrency.

98 items · 5 sections
std::thread

Native OS threads with safe joining, scoped lifetimes, and ergonomic builder configuration.

23 items · 5 sections
std::option

Option<T> is how Rust eliminates null-pointer crashes at compile time. Every absent value is explicit in the type system.

5 items · 5 sections
std::result

Result<T, E> is how Rust handles every kind of failure without exceptions, panics, or hidden control flow.

4 items · 5 sections
std::fmt

Display, Debug, and the underlying Formatter machinery — what every format string is built from.

28 items · 5 sections
std::str

The borrowed counterpart to String. Almost every text-processing function in Rust takes &str.

46 items · 5 sections
std::ops

Add, Sub, Mul, Div, Index, Deref, Range — the traits that give built-in operators their meaning.

57 items · 5 sections
std::mem

Take, swap, replace, drop, size_of, align_of — the surgical tools for working around the borrow checker safely.

58 items · 5 sections
std::ptr

When references and Box are not enough — usually for FFI, intrusive data structures, and lock-free algorithms.

39 items · 5 sections
std::cell

Cell, RefCell, OnceCell — mutate a value through a shared (&) reference, with safety enforced at compile time or at runtime.

11 items · 5 sections
std::env

Read environment variables, command-line args, and the current working directory, and tell what platform you are running on.

30 items · 5 sections
std::time

Instant for elapsed-time measurement, Duration for spans, SystemTime for wall-clock — three types that cover almost every use case

6 items · 5 sections
std::process

Command, Child, Stdio, ExitStatus — everything you need to call out to other binaries.

16 items · 5 sections
std::path

Path and PathBuf are the borrowed/owned pair for filesystem paths — separator-aware, OS-aware, never wrong.

15 items · 5 sections
std::net

TcpStream, TcpListener, UdpSocket, plus the IpAddr family — enough for blocking network code and a foundation for async runtimes.

16 items · 5 sections
std::error

The standard interface every error type implements — source chains, downcasting, and idiomatic error reporting.

5 items · 5 sections
std::marker

Send, Sync, Sized, Copy, Unpin — the marker traits the compiler reasons about implicitly.

29 items · 5 sections
std::num

NonZero* niche-optimised integers, ParseIntError, and the wrapping / saturating / checked arithmetic helpers.

21 items · 5 sections
std::cmp

PartialEq, Eq, PartialOrd, Ord — the four traits behind ==, !=, <, > and how they compose.

19 items · 5 sections
std::slice

&[T] and &mut [T] are the foundation of low-overhead Rust — every Vec, every array, every byte buffer can be sliced.

37 items · 5 sections
std::pin

Pin<P> guarantees the pointee will not move — the building block that makes self-referential async futures sound.

4 items · 5 sections
std::future

Future, Poll, Context, Waker — the four types the compiler's async desugaring is built on.

11 items · 5 sections
std::task

The minimal types every async runtime is built on. You will only see them when implementing a runtime or a custom Future.

12 items · 5 sections
std::panic

panic!, catch_unwind, set_hook, take_hook — the levers that decide what happens when a panic fires.

17 items · 5 sections
std::convert

The traits that govern type conversion. Implement From, get Into for free.

9 items · 5 sections
std::default

A single trait that gives every type a sensible "empty" or "zero" value. Derive it where it makes sense.

2 items · 5 sections