summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorCarl Lerche <me@carllerche.com>2018-08-09 21:56:53 -0700
committerGitHub <noreply@github.com>2018-08-09 21:56:53 -0700
commitd91c775f360d875afb36b56a812ff5f77940981a (patch)
treea03e8a50bad13252a665fb722f206659b7005274 /src
parent96b556fbff07dc0df32ac3d9a9150bde1a2b75db (diff)
Remove dead futures2 code. (#538)
The futures 0.2 crate is not intended for widespread usage. Also, the futures team is exploring the compat shim route. If futures 0.3 support is added to Tokio 0.1, then a different integration route will be explored, making the current code unhelpful.
Diffstat (limited to 'src')
-rw-r--r--src/executor/mod.rs23
-rw-r--r--src/lib.rs6
-rw-r--r--src/runtime/mod.rs27
-rw-r--r--src/runtime/task_executor.rs23
4 files changed, 0 insertions, 79 deletions
diff --git a/src/executor/mod.rs b/src/executor/mod.rs
index 5528d157..3f238f8f 100644
--- a/src/executor/mod.rs
+++ b/src/executor/mod.rs
@@ -61,9 +61,6 @@ pub use tokio_executor::{Executor, DefaultExecutor, SpawnError};
use futures::{Future, IntoFuture};
use futures::future::{self, FutureResult};
-#[cfg(feature = "unstable-futures")]
-use futures2;
-
/// Return value from the `spawn` function.
///
/// Currently this value doesn't actually provide any functionality. However, it
@@ -133,15 +130,6 @@ where F: Future<Item = (), Error = ()> + 'static + Send
Spawn(())
}
-/// Like `spawn`, but compatible with futures 0.2
-#[cfg(feature = "unstable-futures")]
-pub fn spawn2<F>(f: F) -> Spawn
- where F: futures2::Future<Item = (), Error = futures2::Never> + 'static + Send
-{
- ::tokio_executor::spawn2(f);
- Spawn(())
-}
-
impl IntoFuture for Spawn {
type Future = FutureResult<(), ()>;
type Item = ();
@@ -151,14 +139,3 @@ impl IntoFuture for Spawn {
future::ok(())
}
}
-
-#[cfg(feature = "unstable-futures")]
-impl futures2::IntoFuture for Spawn {
- type Future = futures2::future::FutureResult<(), ()>;
- type Item = ();
- type Error = ();
-
- fn into_future(self) -> Self::Future {
- futures2::future::ok(())
- }
-}
diff --git a/src/lib.rs b/src/lib.rs
index ea6582fd..c0a7d8a0 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -80,9 +80,6 @@ extern crate tokio_timer;
extern crate tokio_tcp;
extern crate tokio_udp;
-#[cfg(feature = "unstable-futures")]
-extern crate futures2;
-
pub mod clock;
pub mod executor;
pub mod fs;
@@ -93,9 +90,6 @@ pub mod timer;
pub mod util;
pub use executor::spawn;
-#[cfg(feature = "unstable-futures")]
-pub use executor::spawn2;
-
pub use runtime::run;
pub mod io {
diff --git a/src/runtime/mod.rs b/src/runtime/mod.rs
index 38feb53f..2e5b344d 100644
--- a/src/runtime/mod.rs
+++ b/src/runtime/mod.rs
@@ -129,8 +129,6 @@ use tokio_threadpool as threadpool;
use futures;
use futures::future::Future;
-#[cfg(feature = "unstable-futures")]
-use futures2;
/// Handle to the Tokio runtime.
///
@@ -215,18 +213,6 @@ where F: Future<Item = (), Error = ()> + Send + 'static,
runtime.shutdown_on_idle().wait().unwrap();
}
-/// Start the Tokio runtime using the supplied future to bootstrap execution.
-///
-/// Identical to `run` but works with futures 0.2-style futures.
-#[cfg(feature = "unstable-futures")]
-pub fn run2<F>(future: F)
- where F: futures2::Future<Item = (), Error = futures2::Never> + Send + 'static,
-{
- let mut runtime = Runtime::new().unwrap();
- runtime.spawn2(future);
- runtime.shutdown_on_idle().wait().unwrap();
-}
-
impl Runtime {
/// Create a new runtime instance with default configuration values.
///
@@ -353,19 +339,6 @@ impl Runtime {
self
}
- /// Spawn a futures 0.2-style future onto the Tokio runtime.
- ///
- /// Otherwise identical to `spawn`
- #[cfg(feature = "unstable-futures")]
- pub fn spawn2<F>(&mut self, future: F) -> &mut Self
- where F: futures2::Future<Item = (), Error = futures2::Never> + Send + 'static,
- {
- futures2::executor::Executor::spawn(
- self.inner_mut().pool.sender_mut(), Box::new(future)
- ).unwrap();
- self
- }
-
/// Run a future to completion on the Tokio runtime.
///
/// This runs the given future on the runtime, blocking until it is
diff --git a/src/runtime/task_executor.rs b/src/runtime/task_executor.rs
index ed918be5..e213201a 100644
--- a/src/runtime/task_executor.rs
+++ b/src/runtime/task_executor.rs
@@ -2,8 +2,6 @@
use tokio_threadpool::Sender;
use futures::future::{self, Future};
-#[cfg(feature = "unstable-futures")]
-use futures2;
/// Executes futures on the runtime
///
@@ -74,25 +72,4 @@ impl ::executor::Executor for TaskExecutor {
{
self.inner.spawn(future)
}
-
- #[cfg(feature = "unstable-futures")]
- fn spawn2(&mut self, future: Box<futures2::Future<Item = (), Error = futures2::Never> + Send>)
- -> Result<(), futures2::executor::SpawnError>
- {
- self.inner.spawn2(future)
- }
-}
-
-#[cfg(feature = "unstable-futures")]
-type Task2 = Box<futures2::Future<Item = (), Error = futures2::Never> + Send>;
-
-#[cfg(feature = "unstable-futures")]
-impl futures2::executor::Executor for TaskExecutor {
- fn spawn(&mut self, f: Task2) -> Result<(), futures2::executor::SpawnError> {
- futures2::executor::Executor::spawn(&mut self.inner, f)
- }
-
- fn status(&self) -> Result<(), futures2::executor::SpawnError> {
- futures2::executor::Executor::status(&self.inner)
- }
}