Skip to content

Commit 6207549

Browse files
authored
Merge pull request #40 from kpp/examples
Refactor examples
2 parents d08447f + 5f45657 commit 6207549

File tree

3 files changed

+12
-11
lines changed

3 files changed

+12
-11
lines changed

.github/workflows/rust.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
steps:
1717
- uses: actions/checkout@v2
1818
- name: build
19-
run: cargo build --tests --benches --verbose
19+
run: cargo build --tests --examples --benches --verbose
2020
- name: test
2121
run: cargo test --verbose
2222

@@ -29,7 +29,7 @@ jobs:
2929
- uses: actions-rs/cargo@v1
3030
with:
3131
command: clippy
32-
args: --all --lib --tests -- --deny warnings
32+
args: --all --lib --tests --examples -- --deny warnings
3333

3434
coverage:
3535
name: coverage

examples/future.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ use futures::executor;
22
use futures_async_combinators::future::*;
33

44
fn main() {
5-
executor::block_on(async {
6-
let future = ready(Ok::<i32, i32>(1));
7-
let future = and_then(future, |x| ready(Ok::<i32, i32>(x + 3)));
8-
let future = inspect(future, |x| {
9-
dbg!(x);
10-
});
11-
assert_eq!(future.await, Ok(4));
5+
let future = ready(Ok::<i32, i32>(1));
6+
let future = and_then(future, |x| ready(Ok::<i32, i32>(x + 3)));
7+
let future = inspect(future, |x| {
8+
dbg!(x);
129
});
10+
11+
let res = executor::block_on(future);
12+
assert_eq!(res, Ok(4));
1313
}

examples/stream.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
#![type_length_limit="2111998"]
2-
31
use futures::executor;
42
use futures_async_combinators::stream::*;
53

64
fn main() {
75
let stream = iter(1..=3);
86
let stream = map(stream, |x| x + 1);
97
let stream = map(stream, |x| x * 2);
8+
let stream = inspect(stream, |x| {
9+
dbg!(x);
10+
});
1011

1112
let collect_future = collect(stream);
1213
let collection: Vec<_> = executor::block_on(collect_future);

0 commit comments

Comments
 (0)