
Cargo Profiles Explained Dev Release and Custom Profiles
Profiles are named sets of compiler settings. Learn dev, release, test and bench, the keys that matter, per-package overrides and how to define a custom profile that inherits from release.
Everything you need to level up your coding skills.

Profiles are named sets of compiler settings. Learn dev, release, test and bench, the keys that matter, per-package overrides and how to define a custom profile that inherits from release.

The mistakes that make JWT checks worthless: accepting the none algorithm, trusting the header's alg, skipping exp and aud, and mixing key types. Validate correctly with the jsonwebtoken crate.

Test code that calls out to services with a hand-written fake or a Mockall mock. Compare setup cost, what each can assert and the cases where a fake is the better tool.

Talk to Redis from Rust with redis-rs: a multiplexed async connection through ConnectionManager, commands, pipelines, expiry, pub/sub and handling disconnects.

A Docker build that recompiles every dependency on each code change wastes minutes. cargo-chef splits dependency compilation into its own cached layer. See the Dockerfile and what invalidates it.

Rust iterator chains compile to the same machine code as hand-written loops in most cases. See where they tie, where they differ and the few places where a plain loop is clearer or faster.

Use PostgreSQL LISTEN and NOTIFY from Rust with SQLx PgListener: send notifications from SQL or triggers, receive them in a task, handle reconnects and know the limits.

Store and query JSON in PostgreSQL JSONB from Rust: sqlx Json<T> typed columns, containment and path operators, partial updates, GIN indexes and when a column beats JSON.

Put logic in a library crate and keep main.rs thin, so tests can call functions, integration tests see the public API and other binaries can reuse the code.

Turn a PostgreSQL unique violation into a friendly conflict instead of a 500. Check is_unique_violation on the database error, read the constraint name and map foreign key errors too.

A guide to unsafe Rust: what the keyword allows, the contract it creates, how to wrap it in a safe API, how to check it with Miri and where it is actually needed.

Show progress for long operations with indicatif: bars with known length, spinners for unknown work, wrapping iterators and keeping log lines from garbling the bar.
We send one email when a new post is published. No spam.