1212//! #![feature(futures_api)]
1313//!
1414//! use std::pin::Pin;
15- //! use std::task::{Poll, Waker };
15+ //! use std::task::{Context, Poll };
1616//! use futures::prelude::*;
1717//! use async_ready::AsyncReady;
1818//! use std::io;
2121//!
2222//! impl Future for Fut {
2323//! type Output = ();
24- //! fn poll(self: Pin<&mut Self>, waker : &Waker ) -> Poll<Self::Output> {
24+ //! fn poll(self: Pin<&mut Self>, _cx : &mut Context<'_> ) -> Poll<Self::Output> {
2525//! Poll::Ready(())
2626//! }
2727//! }
3030//! type Ok = ();
3131//! type Err = io::Error;
3232//!
33- //! fn poll_ready(&mut self, waker: &Waker)
34- //! -> Poll<Result<Self::Ok, Self::Err>> {
33+ //! fn poll_ready(
34+ //! mut self: Pin<&mut Self>,
35+ //! cx: &mut Context<'_>,
36+ //! ) -> Poll<Result<Self::Ok, Self::Err>> {
3537//! Poll::Ready(Ok(()))
3638//! }
3739//! }
3840//! ```
3941
4042#![ feature( futures_api) ]
4143
42- use std:: task:: { Poll , Waker } ;
44+ use std:: pin:: Pin ;
45+ use std:: task:: { Context , Poll } ;
4346
4447/// Determine if the underlying API can be written to.
4548pub trait AsyncWriteReady {
@@ -50,7 +53,10 @@ pub trait AsyncWriteReady {
5053 type Err : std:: error:: Error + Send + Sync ;
5154
5255 /// Check if the underlying API can be written to.
53- fn poll_write_ready ( & self , waker : & Waker ) -> Poll < Result < Self :: Ok , Self :: Err > > ;
56+ fn poll_write_ready (
57+ self : Pin < & mut Self > ,
58+ cx : & mut Context < ' _ > ,
59+ ) -> Poll < Result < Self :: Ok , Self :: Err > > ;
5460}
5561
5662/// Determine if the underlying API can be read from.
@@ -62,7 +68,10 @@ pub trait AsyncReadReady {
6268 type Err : std:: error:: Error + Send + Sync ;
6369
6470 /// Check if the underlying API can be read from.
65- fn poll_read_ready ( & self , waker : & Waker ) -> Poll < Result < Self :: Ok , Self :: Err > > ;
71+ fn poll_read_ready (
72+ self : Pin < & mut Self > ,
73+ cx : & mut Context < ' _ > ,
74+ ) -> Poll < Result < Self :: Ok , Self :: Err > > ;
6675}
6776
6877/// Determine if a struct is async-ready to yield futures.
@@ -81,7 +90,10 @@ pub trait AsyncReady {
8190 type Err : std:: error:: Error + Send + Sync ;
8291
8392 /// Check if the stream can be read from.
84- fn poll_ready ( & self , waker : & Waker ) -> Poll < Result < Self :: Ok , Self :: Err > > ;
93+ fn poll_ready (
94+ self : Pin < & mut Self > ,
95+ cx : & mut Context < ' _ > ,
96+ ) -> Poll < Result < Self :: Ok , Self :: Err > > ;
8597}
8698
8799/// Extract an error from the underlying struct that isn't propagated through
0 commit comments