Skip to content

Commit 522689b

Browse files
committed
Turn combinators into async trait methods
1 parent 80ac73f commit 522689b

File tree

4 files changed

+405
-381
lines changed

4 files changed

+405
-381
lines changed

Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ maintenance = { status = "experimental" }
1919

2020
[dependencies]
2121
pin-utils = "=0.1.0-alpha.4"
22+
async-trait = "0.1.3"
2223

2324
[dependencies.futures]
2425
version = "=0.3.0-alpha.18"

benches/future.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ fn bench_map(c: &mut Criterion) {
5858
b.iter(async move || {
5959
use futures_async_combinators::future::*;
6060
let fut = ready(40);
61-
let fut = map(fut, |x| x + 2);
61+
let fut = fut.map(|x| x + 2);
6262
black_box(fut).await
6363
})
6464
}),

examples/future.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ use futures_async_combinators::future::*;
44
fn main() {
55
executor::block_on(async {
66
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| {
7+
let future = future.and_then(|x| ready(Ok::<i32, i32>(x + 3)));
8+
let future = future.inspect(|x| {
99
dbg!(x);
1010
});
1111
assert_eq!(future.await, Ok(4));

0 commit comments

Comments
 (0)