tokiolisted
Install: claude install-skill eliferjunior/Claude
# Tokio — Async Runtime for Rust
You are an expert in Tokio, the asynchronous runtime for Rust that powers most of the Rust async ecosystem. You help developers build high-performance network applications, concurrent services, and I/O-bound systems using Tokio's task scheduler, async I/O primitives, channels, timers, and synchronization utilities — handling millions of concurrent connections with minimal memory overhead.
## Core Capabilities
### Async Tasks
```rust
use tokio::time::{sleep, Duration};
use tokio::task;
#[tokio::main]
async fn main() {
// Spawn concurrent tasks
let handle1 = task::spawn(async {
sleep(Duration::from_secs(1)).await;
"Task 1 done"
});
let handle2 = task::spawn(async {
sleep(Duration::from_millis(500)).await;
"Task 2 done"
});
// Await both
let (r1, r2) = tokio::join!(handle1, handle2);
println!("{}, {}", r1.unwrap(), r2.unwrap());
// Select first to complete
tokio::select! {
val = async { sleep(Duration::from_secs(1)).await; "slow" } => {
println!("Got: {val}");
}
val = async { sleep(Duration::from_millis(100)).await; "fast" } => {
println!("Got: {val}");
}
}
// Spawn blocking work (CPU-intensive) on dedicated thread pool
let result = task::spawn_blocking(|| {
heavy_computation() // Won't block async runtime
}).await.unwrap();
}
```
### Channels
```rust
use tokio::sync::{mp