Skip to content

Commit d106ff9

Browse files
committed
Add examples/future.rs
1 parent 917c122 commit d106ff9

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

examples/future.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#![feature(futures_api, async_await, await_macro)]
2+
3+
use futures_async_combinators::future::*;
4+
use futures::{future, executor};
5+
6+
fn main() {
7+
executor::block_on(async {
8+
let future = future::ready(Ok::<i32, i32>(1));
9+
let future = and_then(future, |x| future::ready(Ok::<i32, i32>(x + 3)));
10+
let future = inspect(future, |x| { dbg!(x); });
11+
assert_eq!(await!(future), Ok(4));
12+
});
13+
}

0 commit comments

Comments
 (0)