Skip to content

Commit

Permalink
Turn combinators into async trait methods
Browse files Browse the repository at this point in the history
  • Loading branch information
kpp committed Aug 22, 2019
1 parent 80ac73f commit 522689b
Show file tree
Hide file tree
Showing 4 changed files with 405 additions and 381 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Expand Up @@ -19,6 +19,7 @@ maintenance = { status = "experimental" }

[dependencies]
pin-utils = "=0.1.0-alpha.4"
async-trait = "0.1.3"

[dependencies.futures]
version = "=0.3.0-alpha.18"
Expand Down
2 changes: 1 addition & 1 deletion benches/future.rs
Expand Up @@ -58,7 +58,7 @@ fn bench_map(c: &mut Criterion) {
b.iter(async move || {
use futures_async_combinators::future::*;
let fut = ready(40);
let fut = map(fut, |x| x + 2);
let fut = fut.map(|x| x + 2);
black_box(fut).await
})
}),
Expand Down
4 changes: 2 additions & 2 deletions examples/future.rs
Expand Up @@ -4,8 +4,8 @@ use futures_async_combinators::future::*;
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| {
let future = future.and_then(|x| ready(Ok::<i32, i32>(x + 3)));
let future = future.inspect(|x| {
dbg!(x);
});
assert_eq!(future.await, Ok(4));
Expand Down

0 comments on commit 522689b

Please sign in to comment.