Skip to content

Commit fb52e30

Browse files
yoshuawuytsNemo157
authored andcommitted
s/Async::/Poll::/
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
1 parent 6e96a85 commit fb52e30

File tree

14 files changed

+79
-79
lines changed

14 files changed

+79
-79
lines changed

futures-channel/src/mpsc/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -548,8 +548,8 @@ impl<T> SenderInner<T> {
548548
///
549549
/// This method returns:
550550
///
551-
/// - `Ok(Async::Ready(_))` if there is sufficient capacity;
552-
/// - `Ok(Async::Pending)` if the channel may not have
551+
/// - `Ok(Poll::Ready(_))` if there is sufficient capacity;
552+
/// - `Ok(Poll::Pending)` if the channel may not have
553553
/// capacity, in which case the current task is queued to be notified once
554554
/// capacity is available;
555555
/// - `Err(SendError)` if the receiver has been dropped.
@@ -642,8 +642,8 @@ impl<T> Sender<T> {
642642
///
643643
/// This method returns:
644644
///
645-
/// - `Ok(Async::Ready(_))` if there is sufficient capacity;
646-
/// - `Ok(Async::Pending)` if the channel may not have
645+
/// - `Ok(Poll::Ready(_))` if there is sufficient capacity;
646+
/// - `Ok(Poll::Pending)` if the channel may not have
647647
/// capacity, in which case the current task is queued to be notified once
648648
/// capacity is available;
649649
/// - `Err(SendError)` if the receiver has been dropped.

futures-channel/tests/oneshot.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ fn cancel_sends() {
155155
// type Error = ();
156156
//
157157
// fn poll(&mut self) -> Poll<Self::Item, Self::Error> {
158-
// Ok(Async::Pending)
158+
// Ok(Poll::Pending)
159159
// }
160160
// }
161161
//
@@ -217,7 +217,7 @@ fn cancel_sends() {
217217
// type Error = ();
218218
//
219219
// fn poll(&mut self) -> Poll<Self::Item, Self::Error> {
220-
// Ok(Async::Pending)
220+
// Ok(Poll::Pending)
221221
// }
222222
// }
223223
//

futures-io/src/lib.rs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -96,18 +96,18 @@ mod if_std {
9696

9797
/// Attempt to read from the `AsyncRead` into `buf`.
9898
///
99-
/// On success, returns `Ok(Async::Ready(num_bytes_read))`.
99+
/// On success, returns `Ok(Poll::Ready(num_bytes_read))`.
100100
///
101101
/// If no data is available for reading, the method returns
102-
/// `Ok(Async::Pending)` and arranges for the current task (via
102+
/// `Ok(Poll::Pending)` and arranges for the current task (via
103103
/// `waker.wake()`) to receive a notification when the object becomes
104104
/// readable or is closed.
105105
///
106106
/// # Implementation
107107
///
108108
/// This function may not return errors of kind `WouldBlock` or
109109
/// `Interrupted`. Implementations must convert `WouldBlock` into
110-
/// `Async::Pending` and either internally retry or convert
110+
/// `Poll::Pending` and either internally retry or convert
111111
/// `Interrupted` into another error kind.
112112
fn poll_read(self: Pin<&mut Self>, waker: &Waker, buf: &mut [u8])
113113
-> Poll<Result<usize>>;
@@ -118,10 +118,10 @@ mod if_std {
118118
/// This method is similar to `poll_read`, but allows data to be read
119119
/// into multiple buffers using a single operation.
120120
///
121-
/// On success, returns `Ok(Async::Ready(num_bytes_read))`.
121+
/// On success, returns `Ok(Poll::Ready(num_bytes_read))`.
122122
///
123123
/// If no data is available for reading, the method returns
124-
/// `Ok(Async::Pending)` and arranges for the current task (via
124+
/// `Ok(Poll::Pending)` and arranges for the current task (via
125125
/// `waker.wake()`) to receive a notification when the object becomes
126126
/// readable or is closed.
127127
/// By default, this method delegates to using `poll_read` on the first
@@ -132,7 +132,7 @@ mod if_std {
132132
///
133133
/// This function may not return errors of kind `WouldBlock` or
134134
/// `Interrupted`. Implementations must convert `WouldBlock` into
135-
/// `Async::Pending` and either internally retry or convert
135+
/// `Poll::Pending` and either internally retry or convert
136136
/// `Interrupted` into another error kind.
137137
fn poll_vectored_read(self: Pin<&mut Self>, waker: &Waker, vec: &mut [&mut IoVec])
138138
-> Poll<Result<usize>>
@@ -156,18 +156,18 @@ mod if_std {
156156
pub trait AsyncWrite {
157157
/// Attempt to write bytes from `buf` into the object.
158158
///
159-
/// On success, returns `Ok(Async::Ready(num_bytes_written))`.
159+
/// On success, returns `Ok(Poll::Ready(num_bytes_written))`.
160160
///
161161
/// If the object is not ready for writing, the method returns
162-
/// `Ok(Async::Pending)` and arranges for the current task (via
162+
/// `Ok(Poll::Pending)` and arranges for the current task (via
163163
/// `waker.wake()`) to receive a notification when the object becomes
164164
/// readable or is closed.
165165
///
166166
/// # Implementation
167167
///
168168
/// This function may not return errors of kind `WouldBlock` or
169169
/// `Interrupted`. Implementations must convert `WouldBlock` into
170-
/// `Async::Pending` and either internally retry or convert
170+
/// `Poll::Pending` and either internally retry or convert
171171
/// `Interrupted` into another error kind.
172172
fn poll_write(self: Pin<&mut Self>, waker: &Waker, buf: &[u8])
173173
-> Poll<Result<usize>>;
@@ -178,10 +178,10 @@ mod if_std {
178178
/// This method is similar to `poll_write`, but allows data from multiple buffers to be written
179179
/// using a single operation.
180180
///
181-
/// On success, returns `Ok(Async::Ready(num_bytes_written))`.
181+
/// On success, returns `Ok(Poll::Ready(num_bytes_written))`.
182182
///
183183
/// If the object is not ready for writing, the method returns
184-
/// `Ok(Async::Pending)` and arranges for the current task (via
184+
/// `Ok(Poll::Pending)` and arranges for the current task (via
185185
/// `waker.wake()`) to receive a notification when the object becomes
186186
/// readable or is closed.
187187
///
@@ -193,7 +193,7 @@ mod if_std {
193193
///
194194
/// This function may not return errors of kind `WouldBlock` or
195195
/// `Interrupted`. Implementations must convert `WouldBlock` into
196-
/// `Async::Pending` and either internally retry or convert
196+
/// `Poll::Pending` and either internally retry or convert
197197
/// `Interrupted` into another error kind.
198198
fn poll_vectored_write(self: Pin<&mut Self>, waker: &Waker, vec: &[&IoVec])
199199
-> Poll<Result<usize>>
@@ -209,35 +209,35 @@ mod if_std {
209209
/// Attempt to flush the object, ensuring that any buffered data reach
210210
/// their destination.
211211
///
212-
/// On success, returns `Ok(Async::Ready(()))`.
212+
/// On success, returns `Ok(Poll::Ready(()))`.
213213
///
214214
/// If flushing cannot immediately complete, this method returns
215-
/// `Ok(Async::Pending)` and arranges for the current task (via
215+
/// `Ok(Poll::Pending)` and arranges for the current task (via
216216
/// `waker.wake()`) to receive a notification when the object can make
217217
/// progress towards flushing.
218218
///
219219
/// # Implementation
220220
///
221221
/// This function may not return errors of kind `WouldBlock` or
222222
/// `Interrupted`. Implementations must convert `WouldBlock` into
223-
/// `Async::Pending` and either internally retry or convert
223+
/// `Poll::Pending` and either internally retry or convert
224224
/// `Interrupted` into another error kind.
225225
fn poll_flush(self: Pin<&mut Self>, waker: &Waker) -> Poll<Result<()>>;
226226

227227
/// Attempt to close the object.
228228
///
229-
/// On success, returns `Ok(Async::Ready(()))`.
229+
/// On success, returns `Ok(Poll::Ready(()))`.
230230
///
231231
/// If closing cannot immediately complete, this function returns
232-
/// `Ok(Async::Pending)` and arranges for the current task (via
232+
/// `Ok(Poll::Pending)` and arranges for the current task (via
233233
/// `waker.wake()`) to receive a notification when the object can make
234234
/// progress towards closing.
235235
///
236236
/// # Implementation
237237
///
238238
/// This function may not return errors of kind `WouldBlock` or
239239
/// `Interrupted`. Implementations must convert `WouldBlock` into
240-
/// `Async::Pending` and either internally retry or convert
240+
/// `Poll::Pending` and either internally retry or convert
241241
/// `Interrupted` into another error kind.
242242
fn poll_close(self: Pin<&mut Self>, waker: &Waker) -> Poll<Result<()>>;
243243
}

futures-sink/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ pub trait Sink<Item> {
5858
/// each call to `start_send`.
5959
///
6060
/// This method returns `Poll::Ready` once the underlying sink is ready to
61-
/// receive data. If this method returns `Async::Pending`, the current task
61+
/// receive data. If this method returns `Poll::Pending`, the current task
6262
/// is registered to be notified (via `waker.wake()`) when `poll_ready`
6363
/// should be called again.
6464
///
@@ -94,7 +94,7 @@ pub trait Sink<Item> {
9494
/// value is returned then it is guaranteed that all previous values sent
9595
/// via `start_send` have been flushed.
9696
///
97-
/// Returns `Ok(Async::Pending)` if there is more work left to do, in which
97+
/// Returns `Ok(Poll::Pending)` if there is more work left to do, in which
9898
/// case the current task is scheduled (via `waker.wake()`) to wake up when
9999
/// `poll_flush` should be called again.
100100
///
@@ -107,7 +107,7 @@ pub trait Sink<Item> {
107107
/// Returns `Ok(Poll::Ready(()))` when no buffered items remain and the sink
108108
/// has been successfully closed.
109109
///
110-
/// Returns `Ok(Async::Pending)` if there is more work left to do, in which
110+
/// Returns `Ok(Poll::Pending)` if there is more work left to do, in which
111111
/// case the current task is scheduled (via `waker.wake()`) to wake up when
112112
/// `poll_close` should be called again.
113113
///

futures-util/benches_disabled/bilock.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ impl Stream for LockStream {
4848

4949
fn poll_next(&mut self, waker: &Waker) -> Poll<Option<Self::Item>, Self::Error> {
5050
self.lock.poll(waker).map(|a| match a {
51-
Async::Ready(a) => Async::Ready(Some(a)),
52-
Async::Pending => Async::Pending,
51+
Poll::Ready(a) => Poll::Ready(Some(a)),
52+
Poll::Pending => Poll::Pending,
5353
})
5454
}
5555
}
@@ -71,20 +71,20 @@ fn contended(b: &mut Bencher) {
7171

7272
for _ in 0..1000 {
7373
let x_guard = match x.poll_next(&mut waker) {
74-
Ok(Async::Ready(Some(guard))) => guard,
74+
Ok(Poll::Ready(Some(guard))) => guard,
7575
_ => panic!(),
7676
};
7777

7878
// Try poll second lock while first lock still holds the lock
7979
match y.poll_next(&mut waker) {
80-
Ok(Async::Pending) => (),
80+
Ok(Poll::Pending) => (),
8181
_ => panic!(),
8282
};
8383

8484
x.release_lock(x_guard);
8585

8686
let y_guard = match y.poll_next(&mut waker) {
87-
Ok(Async::Ready(Some(guard))) => guard,
87+
Ok(Poll::Ready(Some(guard))) => guard,
8888
_ => panic!(),
8989
};
9090

@@ -110,14 +110,14 @@ fn lock_unlock(b: &mut Bencher) {
110110

111111
for _ in 0..1000 {
112112
let x_guard = match x.poll_next(&mut waker) {
113-
Ok(Async::Ready(Some(guard))) => guard,
113+
Ok(Poll::Ready(Some(guard))) => guard,
114114
_ => panic!(),
115115
};
116116

117117
x.release_lock(x_guard);
118118

119119
let y_guard = match y.poll_next(&mut waker) {
120-
Ok(Async::Ready(Some(guard))) => guard,
120+
Ok(Poll::Ready(Some(guard))) => guard,
121121
_ => panic!(),
122122
};
123123

futures-util/bilock.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ fn smoke() {
1414

1515
{
1616
let mut lock = match a.poll_lock() {
17-
Async::Ready(l) => l,
18-
Async::Pending => panic!("poll not ready"),
17+
Poll::Ready(l) => l,
18+
Poll::Pending => panic!("poll not ready"),
1919
};
2020
assert_eq!(*lock, 1);
2121
*lock = 2;
@@ -29,8 +29,8 @@ fn smoke() {
2929

3030
{
3131
let lock = match b.poll_lock() {
32-
Async::Ready(l) => l,
33-
Async::Pending => panic!("poll not ready"),
32+
Poll::Ready(l) => l,
33+
Poll::Pending => panic!("poll not ready"),
3434
};
3535
assert_eq!(*lock, 2);
3636
}
@@ -67,12 +67,12 @@ fn concurrent() {
6767
let a = t1.join().unwrap().expect("a error");
6868

6969
match a.poll_lock() {
70-
Async::Ready(l) => assert_eq!(*l, 2 * N),
71-
Async::Pending => panic!("poll not ready"),
70+
Poll::Ready(l) => assert_eq!(*l, 2 * N),
71+
Poll::Pending => panic!("poll not ready"),
7272
}
7373
match b.poll_lock() {
74-
Async::Ready(l) => assert_eq!(*l, 2 * N),
75-
Async::Pending => panic!("poll not ready"),
74+
Poll::Ready(l) => assert_eq!(*l, 2 * N),
75+
Poll::Pending => panic!("poll not ready"),
7676
}
7777

7878
assert_eq!(a.reunite(b).expect("bilock/concurrent: reunite error"), 2 * N);
@@ -94,8 +94,8 @@ fn concurrent() {
9494

9595
let a = self.a.as_ref().unwrap();
9696
let mut a = match a.poll_lock() {
97-
Async::Ready(l) => l,
98-
Async::Pending => return Ok(Async::Pending),
97+
Poll::Ready(l) => l,
98+
Poll::Pending => return Ok(Poll::Pending),
9999
};
100100
self.remaining -= 1;
101101
*a += 1;

futures-util/src/future/disabled/select.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ impl<A, B> Future for Select<A, B> where A: Future, B: Future {
2222
let (mut a, mut b) = self.inner.take().expect("cannot poll Select twice");
2323
match a.poll(waker) {
2424
Err(e) => Err(Either::Left((e, b))),
25-
Ok(Async::Ready(x)) => Ok(Async::Ready(Either::Left((x, b)))),
26-
Ok(Async::Pending) => match b.poll(waker) {
25+
Ok(Poll::Ready(x)) => Ok(Poll::Ready(Either::Left((x, b)))),
26+
Ok(Poll::Pending) => match b.poll(waker) {
2727
Err(e) => Err(Either::Right((e, a))),
28-
Ok(Async::Ready(x)) => Ok(Async::Ready(Either::Right((x, a)))),
29-
Ok(Async::Pending) => {
28+
Ok(Poll::Ready(x)) => Ok(Poll::Ready(Either::Right((x, a)))),
29+
Ok(Poll::Pending) => {
3030
self.inner = Some((a, b));
31-
Ok(Async::Pending)
31+
Ok(Poll::Pending)
3232
}
3333
}
3434
}

futures-util/src/future/disabled/select_all.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ impl<A> Future for SelectAll<A>
4949
fn poll(&mut self, waker: &Waker) -> Poll<Self::Item, Self::Error> {
5050
let item = self.inner.iter_mut().enumerate().filter_map(|(i, f)| {
5151
match f.poll(waker) {
52-
Ok(Async::Pending) => None,
53-
Ok(Async::Ready(e)) => Some((i, Ok(e))),
52+
Ok(Poll::Pending) => None,
53+
Ok(Poll::Ready(e)) => Some((i, Ok(e))),
5454
Err(e) => Some((i, Err(e))),
5555
}
5656
}).next();
@@ -59,11 +59,11 @@ impl<A> Future for SelectAll<A>
5959
self.inner.remove(idx);
6060
let rest = mem::replace(&mut self.inner, Vec::new());
6161
match res {
62-
Ok(e) => Ok(Async::Ready((e, idx, rest))),
62+
Ok(e) => Ok(Poll::Ready((e, idx, rest))),
6363
Err(e) => Err((e, idx, rest)),
6464
}
6565
}
66-
None => Ok(Async::Pending),
66+
None => Ok(Poll::Pending),
6767
}
6868
}
6969
}

futures-util/src/future/disabled/select_ok.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ impl<A> Future for SelectOk<A> where A: Future {
4646
loop {
4747
let item = self.inner.iter_mut().enumerate().filter_map(|(i, f)| {
4848
match f.poll(waker) {
49-
Ok(Async::Pending) => None,
50-
Ok(Async::Ready(e)) => Some((i, Ok(e))),
49+
Ok(Poll::Pending) => None,
50+
Ok(Poll::Ready(e)) => Some((i, Ok(e))),
5151
Err(e) => Some((i, Err(e))),
5252
}
5353
}).next();
@@ -59,7 +59,7 @@ impl<A> Future for SelectOk<A> where A: Future {
5959
match res {
6060
Ok(e) => {
6161
let rest = mem::replace(&mut self.inner, Vec::new());
62-
return Ok(Async::Ready((e, rest)))
62+
return Ok(Poll::Ready((e, rest)))
6363
},
6464
Err(e) => {
6565
if self.inner.is_empty() {
@@ -70,7 +70,7 @@ impl<A> Future for SelectOk<A> where A: Future {
7070
}
7171
None => {
7272
// based on the filter above, nothing is ready, return
73-
return Ok(Async::Pending)
73+
return Ok(Poll::Pending)
7474
},
7575
}
7676
}

futures-util/src/lock/bilock.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,12 @@ impl<T> BiLock<T> {
7575
///
7676
/// This function will acquire the lock in a nonblocking fashion, returning
7777
/// immediately if the lock is already held. If the lock is successfully
78-
/// acquired then `Async::Ready` is returned with a value that represents
78+
/// acquired then `Poll::Ready` is returned with a value that represents
7979
/// the locked value (and can be used to access the protected data). The
8080
/// lock is unlocked when the returned `BiLockGuard` is dropped.
8181
///
8282
/// If the lock is already held then this function will return
83-
/// `Async::Pending`. In this case the current task will also be scheduled
83+
/// `Poll::Pending`. In this case the current task will also be scheduled
8484
/// to receive a notification when the lock would otherwise become
8585
/// available.
8686
///

0 commit comments

Comments
 (0)