Skip to content

Part II: The Standard Library

Part II covers the std::* modules a program uses to reach the outside world: arguments and environment, files, JSON, HTTP, sockets and TLS, cryptography, and the telemetry a running program emits. Everything here builds on Part I and works the same in a short script as in a long-lived service.

fn main() {
let user = std::env::var("USER");
let name = if user == "" { "world" } else { user };
println(f"hello, {name}");
}
Section Chapters
Inputs CLI Arguments & Environment · Filesystem I/O · JSON Encoding & Decoding
Networking HTTP Servers & Clients · TCP, UDP, Unix Sockets & TLS · Cryptography, Hashing & Randomness
Telemetry Structured Logging · Metrics · Observability & Probes

Next: CLI Arguments & Environment.