From 011ebf44eb1f7924259b830f0c4257019f21ad5f Mon Sep 17 00:00:00 2001 From: Sean McArthur Date: Thu, 14 Jun 2018 16:28:23 -0700 Subject: [PATCH] Implement Executor for Box (#420) --- tokio-executor/src/lib.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tokio-executor/src/lib.rs b/tokio-executor/src/lib.rs index 220a66f1b..d08b5b618 100644 --- a/tokio-executor/src/lib.rs +++ b/tokio-executor/src/lib.rs @@ -182,6 +182,25 @@ pub trait Executor { } } +impl Executor for Box { + fn spawn(&mut self, future: Box + Send>) + -> Result<(), SpawnError> + { + (**self).spawn(future) + } + + #[cfg(feature = "unstable-futures")] + fn spawn2(&mut self, future: Box + Send>) + -> Result<(), futures2::executor::SpawnError> + { + (**self).spawn2(future) + } + + fn status(&self) -> Result<(), SpawnError> { + (**self).status() + } +} + /// Errors returned by `Executor::spawn`. /// /// Spawn errors should represent relatively rare scenarios. Currently, the two