async-macros 2.0.0

Macros for async-std.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
fn main() {
    futures::executor::block_on(async {
        async fn main() -> Result<(), std::io::Error> {
            use async_macros::try_select;
            use futures::future;
            use std::io::{Error, ErrorKind};

            let a = future::pending::<Result<u8, Error>>();
            let b = future::ready(Err(Error::from(ErrorKind::Other)));
            let c = future::ready(Ok(1u8));

            assert_eq!(try_select!(a, b, c).await?, 1u8);
            Ok(())
        }
        main().await.unwrap();
    });
}