async-flow 0.1.5

Async abstractions for flow-based programming (FBP).
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// This is free and unencumbered software released into the public domain.

/// cargo run --example basic
#[tokio::main(flavor = "current_thread")]
pub async fn main() {
    let (outputs, mut inputs) = async_flow::Channel::bounded(1).into_inner();

    tokio::spawn(async move {
        outputs.send("value1").await.unwrap();
        outputs.send("value2").await.unwrap();
    });

    while let Some(message) = inputs.recv().await.unwrap() {
        eprintln!("recv: {}", message);
    }
}