How to use tokio mpsc channel

Create an async channel with trpl::channel, send data via tx.send, and receive it with rx.recv.await inside a Tokio runtime.

Use trpl::channel() to create an unbounded async channel, then send data with tx.send() and receive it with rx.recv().await inside an async runtime.

use trpl::{channel, block_on, spawn_task};

#[tokio::main]
async fn main() {
    let (tx, mut rx) = channel::<String>();
    
    spawn_task(async move {
        tx.send("Hello from async".to_string()).unwrap();
    });

    let msg = rx.recv().await.unwrap();
    println!("Received: {msg}");
}