mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 23:04:33 +00:00
Impl Executor for Box<E: Executor>
This commit is contained in:
parent
f498e4ec1b
commit
75d22263c9
@ -67,7 +67,7 @@ use core::marker::{Unpin, Unsize};
|
||||
use core::mem::{self, PinMut};
|
||||
use core::ops::{CoerceUnsized, Deref, DerefMut, Generator, GeneratorState};
|
||||
use core::ptr::{self, NonNull, Unique};
|
||||
use core::task::{Context, Poll};
|
||||
use core::task::{Context, Poll, Executor, SpawnErrorKind, SpawnObjError};
|
||||
|
||||
use raw_vec::RawVec;
|
||||
use str::from_boxed_utf8_unchecked;
|
||||
@ -972,6 +972,19 @@ unsafe impl<'a, T, F> UnsafeFutureObj<'a, T> for PinBox<F>
|
||||
}
|
||||
}
|
||||
|
||||
#[unstable(feature = "futures_api", issue = "50547")]
|
||||
impl<E> Executor for Box<E>
|
||||
where E: Executor + ?Sized
|
||||
{
|
||||
fn spawn_obj(&mut self, task: FutureObj<'static, ()>) -> Result<(), SpawnObjError> {
|
||||
(**self).spawn_obj(task)
|
||||
}
|
||||
|
||||
fn status(&self) -> Result<(), SpawnErrorKind> {
|
||||
(**self).status()
|
||||
}
|
||||
}
|
||||
|
||||
#[unstable(feature = "futures_api", issue = "50547")]
|
||||
impl<'a, F: Future<Output = ()> + Send + 'a> From<PinBox<F>> for FutureObj<'a, ()> {
|
||||
fn from(boxed: PinBox<F>) -> Self {
|
||||
|
Loading…
Reference in New Issue
Block a user