From 837637253d4b36167717a9441eb4dcddce4348a0 Mon Sep 17 00:00:00 2001 From: Nicholas Date: Mon, 28 Oct 2019 11:20:23 -0600 Subject: [PATCH] Remove dev dependency on the runtime crate Resolves #333 --- Cargo.toml | 1 - examples/runtime.rs | 27 --------------------------- 2 files changed, 28 deletions(-) delete mode 100644 examples/runtime.rs diff --git a/Cargo.toml b/Cargo.toml index d0e79c2b4..ad6d1a1f5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -56,7 +56,6 @@ mime_guess = "2.0.1" percent-encoding = "2.0.0" serde = { version = "1.0.91", features = ["derive"] } tera = "0.11" -runtime = "0.3.0-alpha.7" # Tide components tide-log = { path = "./tide-log", default-features = false } diff --git a/examples/runtime.rs b/examples/runtime.rs deleted file mode 100644 index fa8d2f95e..000000000 --- a/examples/runtime.rs +++ /dev/null @@ -1,27 +0,0 @@ -/// An example of how to run a Tide service on top of `runtime`, this also shows the pieces -/// necessary if you wish to run a service on some other executor/IO source. - -#[runtime::main] -async fn main() -> Result<(), Box> { - // First, we create a simple hello world application - let mut app = tide::App::new(); - app.at("/").get(|_| async move { "Hello, world!" }); - - // Instead of using `App::run` to start the application, which implicitly uses a default - // http-service server, we need to configure a custom server with the executor and IO source we - // want it to use and then run the Tide service on it. - - // Turn the `tide::App` into a generic `http_service::HttpService` - let http_service = app.into_http_service(); - - // Build an `http_service_hyper::Server` using runtime's `TcpListener` and `Spawn` instances - // instead of hyper's defaults. - let mut listener = runtime::net::TcpListener::bind("127.0.0.1:8000")?; - let server = http_service_hyper::Server::builder(listener.incoming()) - .with_spawner(runtime::task::Spawner::new()); - - // Serve the Tide service on the configured server, and wait for it to complete - server.serve(http_service).await?; - - Ok(()) -}