Skip to content

Commit 44ba8e9

Browse files
committed
Add examples/stream.rs
1 parent 20a228f commit 44ba8e9

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

examples/stream.rs

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#![feature(futures_api, async_await, await_macro)]
2+
3+
use futures_async_combinators::stream::*;
4+
use futures::{stream, executor};
5+
6+
fn main() {
7+
let stream = stream::iter(1..=3);
8+
let stream = map(stream, |x| x + 1);
9+
let stream = map(stream, |x| x * 2);
10+
11+
let collect_future = collect(stream);
12+
let collection : Vec<_> = executor::block_on(collect_future);
13+
14+
assert_eq!(vec![4, 6, 8], collection);
15+
}

0 commit comments

Comments
 (0)