Simultaneous futures compat (#172)

This patch adds opt-in support for futures 0.2.
This commit is contained in:
Aaron Turon
2018-03-13 13:57:35 -07:00
committed by Carl Lerche
parent 5846b3fc2a
commit d304791c0e
27 changed files with 1045 additions and 105 deletions
+12 -1
View File
@@ -35,6 +35,9 @@
extern crate futures;
#[cfg(feature = "unstable-futures")]
extern crate futures2;
mod enter;
mod global;
pub mod park;
@@ -42,6 +45,9 @@ pub mod park;
pub use enter::{enter, Enter, EnterError};
pub use global::{spawn, with_default, DefaultExecutor};
#[cfg(feature = "unstable-futures")]
pub use global::spawn2;
use futures::Future;
/// A value that executes futures.
@@ -129,7 +135,12 @@ pub trait Executor {
/// # fn main() {}
/// ```
fn spawn(&mut self, future: Box<Future<Item = (), Error = ()> + Send>)
-> Result<(), SpawnError>;
-> Result<(), SpawnError>;
/// Like `spawn`, but compatible with futures 0.2
#[cfg(feature = "unstable-futures")]
fn spawn2(&mut self, future: Box<futures2::Future<Item = (), Error = futures2::Never> + Send>)
-> Result<(), futures2::executor::SpawnError>;
/// Provides a best effort **hint** to whether or not `spawn` will succeed.
///