futures-async-combinators 0.2.0

toy futures combinators
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
#![feature(futures_api, async_await, await_macro)]

use futures_async_combinators::future::*;
use futures::executor;

fn main() {
    executor::block_on(async {
        let future = ready(Ok::<i32, i32>(1));
        let future = and_then(future, |x| ready(Ok::<i32, i32>(x + 3)));
        let future = inspect(future, |x| { dbg!(x); });
        assert_eq!(await!(future), Ok(4));
    });
}