diff options
| author | tinaun <tinagma@gmail.com> | 2018-07-24 15:33:19 -0400 |
|---|---|---|
| committer | tinaun <tinagma@gmail.com> | 2018-07-24 17:09:12 -0400 |
| commit | 75d22263c92c28510a1bff2a91031d28817443d8 (patch) | |
| tree | 6563b2dc297225b1049987f2a792811e83eccc2d /src/liballoc | |
| parent | f498e4ec1b57c3245a2fb8e0d5d836ed56760d2d (diff) | |
| download | rust-75d22263c92c28510a1bff2a91031d28817443d8.tar.gz rust-75d22263c92c28510a1bff2a91031d28817443d8.zip | |
Impl Executor for Box<E: Executor>
Diffstat (limited to 'src/liballoc')
| -rw-r--r-- | src/liballoc/boxed.rs | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/liballoc/boxed.rs b/src/liballoc/boxed.rs index 6d3bc6e79b5..2cf9b13a67a 100644 --- a/src/liballoc/boxed.rs +++ b/src/liballoc/boxed.rs @@ -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; @@ -973,6 +973,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 { FutureObj::new(boxed) |
