
Why Tokio Spawn Needs a Static Future and How to Cope
tokio::spawn demands a future that owns its data. Learn why the compiler asks for static, what it does and does not mean, and four ways to share data with a task.
Everything you need to level up your coding skills.

tokio::spawn demands a future that owns its data. Learn why the compiler asks for static, what it does and does not mean, and four ways to share data with a task.

embedded-hal defines traits for pins, buses and delays so one sensor driver runs on any chip. Write a driver generic over I2C and see how to test it with a mock.

Model a tool with verbs, like git add and git commit, using a clap Subcommand enum. Shows global flags, per-command arguments and dispatch with match.

async and await are syntax over futures. Learn what async blocks capture, where await may appear, how errors and ? work, and the common first mistakes.

Handler arguments in Axum are extractors that run in order, and only the last one may consume the request body. Learn the rule and the error it prevents.

An async fn compiles to a state machine that implements Future. See the generated shape, what poll does, and why a future does nothing until it is polled.

Spawn tasks with tokio::spawn, wait for them with JoinHandle and collect results with JoinSet. Includes the Send and static bounds and the panics join returns.

Generic Rust code is compiled once per concrete type, which is why it is as fast as hand written code and why binaries grow. See what that looks like.

String owns its text and str is a borrowed view of text somewhere else. Use that split to pick the right type in function signatures and structs.

Every section of Cargo.toml that matters, with an example: package metadata, dependency forms, dev and build dependencies, features, targets, profiles and lints.

Put unit tests in a cfg(test) module at the bottom of the file they test. See how the test harness discovers them, the access to private items and naming conventions that read well.

E0119 means two impl blocks could apply to the same type. See the common triggers, such as blanket impls and derive plus manual impl, and how to resolve them.
We send one email when a new post is published. No spam.