tokio::sync::mpsc — async channel. std::sync::mpsc — blocking channel.
tokio::sync::mpsc:
std::sync::mpsc:
1use tokio::sync::mpsc;23let (tx, mut rx) = mpsc::channel(32);4tx.send("hello").await.unwrap();5let msg = rx.recv().await.unwrap();67use std::sync::mpsc;8let (tx, rx) = mpsc::channel();9tx.send("hello").unwrap();10let msg = rx.recv().unwrap();
Key: tokio for async, std for blocking.