tokio
Installation
SKILL.md
Tokio
Structured notes on Tokio 1.x, distilled from the tokio-rs/tokio repo, the official guide at tokio.rs/tokio/tutorial, and docs.rs/tokio. It covers the runtime's mental model, the guide's task/channel/concurrency recipes, and the feature-flag and release policy. It does NOT replace the API docs: use it to pick the module and pattern, then read the exact signature on docs.rs. Knowledge only, no scripts.
When to Use
- "nothing runs until I
.await", "my async server stalls", "this task never fires" - Choosing between
tokio::spawn,tokio::task::spawn_blocking, and a rayon/thread pool - Picking a channel (
oneshot/mpsc/watch/broadcast) or aselect!shape - Reading bytes off a socket, framing them into messages, writing an echo-style server
- Graceful shutdown, bridging blocking sync code, testing async code,
tracingsetup - "which feature flags do I need", "which version do I pin" (MSRV / LTS)
Prerequisites
- Rust toolchain installed via rustup; the guide assumes basic Rust.
- Applications:
tokio = { version = "1", features = ["full"] }inCargo.toml. - Libraries: enable only what you use, e.g.
features = ["rt", "net"]or["sync"]. - The tutorial is built around
mini-redis(cargo install mini-redis); the recipes here stand alone. - Load a chapter on demand:
skill_view(name="tokio", file_path="references/<file>.md").