
Axum Versus Actix Web and How to Choose With Numbers
Axum and Actix Web are both fast and mature. The real differences are the runtime model, middleware ecosystem and ergonomics, and this post lays out how to decide.
Everything you need to level up your coding skills.

Axum and Actix Web are both fast and mature. The real differences are the runtime model, middleware ecosystem and ergonomics, and this post lays out how to decide.

E0282 means the compiler cannot work out a type from context. Add a turbofish, a let annotation or a typed collect and it goes away.

Make code that uses random numbers testable: inject the generator, seed it, test properties instead of values, and keep production randomness unpredictable.

A working guide to error handling in Rust: Result, the question mark, custom error types, anyhow and thiserror, and the line between a panic and an error.

Which release profile settings change speed, size and compile time: lto, codegen-units, opt-level, panic abort, strip and debug. A table of effects, a recommended starting point and how to measure.

Make code that depends on the clock testable: pass the time in, define a Clock trait or closure, use a fake clock that you advance, and pause time in Tokio tests.

Rust's type system does not stop SQL injection, but parameterized queries do. See the vulnerable pattern, how bind parameters fix it, what cannot be bound and how to handle dynamic identifiers safely.

Insta stores the expected output of a test in a file and shows a diff when it changes. Learn the review workflow with cargo insta, inline snapshots, redactions and when snapshots go wrong.

Build a Rust service image in two stages so the final image holds only the binary and what it needs to run. See the Dockerfile, the sizes to expect and the checks that it works.

Every v[i] checks the index. In many loops the optimizer proves the check unnecessary and removes it. Learn when that happens, how to help it and why unchecked indexing is rarely worth it.

The log crate is a facade and env_logger is one backend. Set it up, pick levels by RUST_LOG, log with lazy arguments and learn why libraries only depend on log.

Criterion gives statistics and plots on stable Rust; Divan gives a lighter attribute-based API with allocation counting. Compare setup, output, features and pitfalls.
We send one email when a new post is published. No spam.