1
Fork 0

Update the future/task API

This change updates the future and task API as discussed in the stabilization RFC at https://github.com/rust-lang/rfcs/pull/2592.

Changes:
- Replacing UnsafeWake with RawWaker and RawWakerVtable
- Removal of LocalWaker
- Removal of Arc-based Wake trait
This commit is contained in:
Matthias Einwag 2019-01-29 19:02:42 -08:00
parent 4f4f4a40b6
commit d9a4b22d32
9 changed files with 114 additions and 414 deletions

View file

@ -12,7 +12,7 @@ use panicking;
use ptr::{Unique, NonNull};
use rc::Rc;
use sync::{Arc, Mutex, RwLock, atomic};
use task::{LocalWaker, Poll};
use task::{Waker, Poll};
use thread::Result;
#[stable(feature = "panic_hooks", since = "1.10.0")]
@ -323,9 +323,9 @@ impl<T: fmt::Debug> fmt::Debug for AssertUnwindSafe<T> {
impl<'a, F: Future> Future for AssertUnwindSafe<F> {
type Output = F::Output;
fn poll(self: Pin<&mut Self>, lw: &LocalWaker) -> Poll<Self::Output> {
fn poll(self: Pin<&mut Self>, waker: &Waker) -> Poll<Self::Output> {
let pinned_field = unsafe { Pin::map_unchecked_mut(self, |x| &mut x.0) };
F::poll(pinned_field, lw)
F::poll(pinned_field, waker)
}
}