Macro join::join_async

source ·
join_async!() { /* proc-macro */ }
Expand description

Use to combine futures. It produces tuple of values or single value in case of 1 branch.

Example:

#![recursion_limit="256"]

extern crate join;
extern crate futures;

use join::join_async;
use futures::future::{ready};
use futures::stream::iter;

#[tokio::main]
async fn main() {
    let filtered: Vec<_> = join_async! { iter(vec![1u8,2,3]) ?> |v| ready(v % 2 == 0) =>[] }.await;
    assert_eq!(filtered, vec![2]);
}