#[tokio::main] async fn main() { type Message = u8; type Response = bool; const BUFFER_SIZE: usize = 10; let (mut tx, mut rx) = response_channel::channel::(BUFFER_SIZE, None); tokio::task::spawn(async move { for i in 0..10 { let response = tx.send_await_automatic(i).await.unwrap().unwrap(); assert_eq!(response, i >= 5); } }); while let Some((message, tx)) = rx.recv().await { let response = message >= 5; tx.send(response).await.unwrap(); } }