Building a production HTTP backend in Rust means more than wiring up routes. This post builds a complete Axum service with connection pooling, structured middleware, unified error handling, and graceful shutdown – patterns that hold up under real production load.
Tag: Rust
Async Rust with Tokio Part 5: Channels and Communication Patterns – mpsc, oneshot, broadcast, watch
Tokio provides four channel types for inter-task communication: mpsc, oneshot, broadcast, and watch. Each solves a different problem. This post maps out when to use each one, shows the actor and pipeline patterns in practice, and covers the backpressure and lagging behavior that matters in production.
Async Rust with Tokio Part 4: Tasks, Spawning, and Structured Concurrency
Tasks are the unit of concurrency in Tokio. This post covers spawning tasks, managing their lifetimes with JoinHandle and JoinSet, cancellation semantics, sharing state between tasks, and the common mistakes that cause memory leaks and unbounded resource consumption.
Async Rust with Tokio Part 3: State Machines Under the Hood – What the Compiler Generates from async fn
Every async function in Rust compiles into a state machine struct. This post shows exactly what the compiler generates, why some futures are large, why Pin is required, and how the zero-cost composition model works in practice.
Async Rust with Tokio Part 2: Tokio Architecture Deep Dive – Scheduler, epoll, and Thread Model
Tokio is far more than an async runtime. This post goes inside the work-stealing scheduler, the epoll/kqueue/IOCP integration, the timer wheel, and the thread model that lets Tokio handle massive concurrency on a small number of threads.
Async Rust with Tokio Part 1: How Async Rust Works – Futures, Poll, and the Runtime Model
Before you can use Tokio effectively, you need to understand what async Rust actually is under the hood. This post covers the Future trait, the poll model, why Rust has no built-in runtime, and how laziness gives you control that most async runtimes do not.
Async Rust with Tokio Series Part 1: How Async Rust Works – Futures, Poll, and the Runtime Gap
Most async Rust tutorials start with Tokio and skip what async actually is. This post goes back to first principles – the Future trait, the poll model, why Rust ships no runtime, and what a runtime is actually doing when it runs your code.
Advanced Rust Series Part 10: Advanced Lifetime Tricks – Variance, PhantomData, and Zero-Cost Abstractions
The final part of the series goes deep into the type system: variance, PhantomData, the drop checker, and the techniques library authors use to write APIs that are both safe and zero-cost. The type-state pattern, newtype pattern, and phantom ownership explained with production-grade examples.
Advanced Rust Series Part 9: Lifetime Patterns in Production Code – Common Mistakes and How to Fix Them
Theory is one thing. Production code is another. This post covers the ownership and lifetime patterns that appear in real Rust codebases, the mistakes developers make repeatedly, and the diagnosis process that resolves borrow checker conflicts that have no obvious fix.
Advanced Rust Series Part 8: The Self-Referential Struct Problem – Pin, Unpin, and Async State Machines
Pin and Unpin are two of the most conceptually difficult parts of Rust. They exist to support self-referential structs and async state machines – understanding them demystifies how async Rust works under the hood and when you actually need to think about them.