From 6ae5889f8378b6454d4dc620f33bd1678d0e00e4 Mon Sep 17 00:00:00 2001 From: Sean McArthur Date: Wed, 4 Dec 2019 11:15:09 -0800 Subject: [PATCH] feat(rt): introduce `rt::Executor` trait The `hyper::rt::Executor` trait allows defining custom executors to be used with hyper's `Client` and `Server`. Closes #1944 BREAKING CHANGE: Any type passed to the `executor` builder methods must now implement `hyper::rt::Executor`. `hyper::rt::spawn` usage should be replaced with `tokio::task::spawn`. `hyper::rt::run` usage should be replaced with `#[tokio::main]` or managing a `tokio::runtime::Runtime` manually. --- Cargo.toml | 2 +- examples/single_threaded.rs | 3 --- src/rt.rs | 2 +- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index da5fac3bfb..854af439cc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -60,7 +60,7 @@ default = [ ] runtime = [ "tcp", - "tokio/time", + "tokio/rt-core", ] tcp = [ "net2", diff --git a/examples/single_threaded.rs b/examples/single_threaded.rs index 7f7db7924b..eb45448862 100644 --- a/examples/single_threaded.rs +++ b/examples/single_threaded.rs @@ -1,5 +1,3 @@ -fn main() {} -/* #![deny(warnings)] use std::cell::Cell; @@ -74,4 +72,3 @@ where tokio::task::spawn_local(fut); } } -*/ diff --git a/src/rt.rs b/src/rt.rs index 4eefab5bf4..4e60139a87 100644 --- a/src/rt.rs +++ b/src/rt.rs @@ -5,4 +5,4 @@ //! If the `runtime` feature is disabled, the types in this module can be used //! to plug in other runtimes. -//pub use crate::common::Executor; +pub use crate::common::Executor;