Skip to content

Commit 68c2101

Browse files
committed
Update to new stable futures API
1 parent 7cf9a82 commit 68c2101

File tree

8 files changed

+12
-12
lines changed

8 files changed

+12
-12
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
language: rust
22
sudo: false
33
rust:
4-
- nightly-2019-02-19
4+
- nightly-2019-04-26
55

66
os:
77
- linux

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ edition = "2018"
1414
pin-utils = "=0.1.0-alpha.4"
1515

1616
[dependencies.futures]
17-
version = "=0.3.0-alpha.13"
17+
version = "=0.3.0-alpha.15"
1818
package = "futures-preview"

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ like `FutureExt::map`, `TryFutureExt::and_then`...
99

1010
# Requirements
1111

12-
Rust nightly-2019-02-19 for async_await, await_macro...
12+
Rust nightly-2019-04-26 for async_await, await_macro...
1313

1414
# State
1515

examples/future.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![feature(futures_api, async_await, await_macro)]
1+
#![feature(async_await, await_macro)]
22

33
use futures_async_combinators::future::*;
44
use futures::executor;

examples/stream.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![feature(futures_api, async_await, await_macro)]
1+
#![feature(async_await, await_macro)]
22

33
use futures_async_combinators::stream::*;
44
use futures::executor;

src/future.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use futures::future::Future;
22
use futures::stream::Stream;
33

4-
use core::task::{Poll, Waker};
4+
use core::task::{Poll, Context};
55

66
pub async fn ready<T>(value: T) -> T {
77
value
@@ -140,15 +140,15 @@ pub fn into_stream<Fut>(future: Fut) -> impl Stream<Item = Fut::Output>
140140
}
141141

142142
pub fn poll_fn<F, T>(f: F) -> impl Future<Output = T>
143-
where F: FnMut(&Waker) -> Poll<T>,
143+
where F: FnMut(&mut Context) -> Poll<T>,
144144
{
145145
use std::future::from_generator;
146-
use std::future::get_task_waker;
146+
use std::future::get_task_context;
147147

148148
from_generator(|| {
149149
let mut f = f;
150150
loop {
151-
let poll_result = get_task_waker(|waker| f(waker));
151+
let poll_result = get_task_context(|context: &mut Context| f(context));
152152
match poll_result {
153153
Poll::Pending => yield,
154154
Poll::Ready(value) => return value,
@@ -288,7 +288,7 @@ mod tests {
288288
#[test]
289289
fn test_poll_fn() {
290290
executor::block_on(async {
291-
let read_line = |_waker: &_| -> Poll<String> {
291+
let read_line = |_context: &mut Context| -> Poll<String> {
292292
Poll::Ready("Hello, World!".into())
293293
};
294294

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![feature(async_await, await_macro, futures_api, gen_future, generators)]
1+
#![feature(async_await, await_macro, gen_future, generators)]
22

33
pub mod future;
44
pub mod stream;

src/stream.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ pub async fn next<St>(stream: &mut St) -> Option<St::Item>
1010
where St: Stream + Unpin,
1111
{
1212
use crate::future::poll_fn;
13-
let future_next = poll_fn(|waker| Pin::new(&mut *stream).poll_next(waker));
13+
let future_next = poll_fn(|context| Pin::new(&mut *stream).poll_next(context));
1414
await!(future_next)
1515
}
1616

0 commit comments

Comments
 (0)