From f5fd6bc49fd0886cf4a1c76de44c259aff7426c9 Mon Sep 17 00:00:00 2001 From: linkmauve Date: Mon, 6 Jan 2020 16:15:04 +0100 Subject: [PATCH] Fix actix-http examples (#1259) Fix actix-http examples --- actix-http/examples/echo.rs | 4 +++- actix-http/examples/echo2.rs | 4 +++- actix-http/examples/hello-world.rs | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/actix-http/examples/echo.rs b/actix-http/examples/echo.rs index 5b2894f8939..3d57a472a5a 100644 --- a/actix-http/examples/echo.rs +++ b/actix-http/examples/echo.rs @@ -7,7 +7,8 @@ use futures::StreamExt; use http::header::HeaderValue; use log::info; -fn main() -> io::Result<()> { +#[actix_rt::main] +async fn main() -> io::Result<()> { env::set_var("RUST_LOG", "echo=info"); env_logger::init(); @@ -37,4 +38,5 @@ fn main() -> io::Result<()> { .tcp() })? .run() + .await } diff --git a/actix-http/examples/echo2.rs b/actix-http/examples/echo2.rs index 07d18127781..f89ea2dfbba 100644 --- a/actix-http/examples/echo2.rs +++ b/actix-http/examples/echo2.rs @@ -19,7 +19,8 @@ async fn handle_request(mut req: Request) -> Result { .body(body)) } -fn main() -> io::Result<()> { +#[actix_rt::main] +async fn main() -> io::Result<()> { env::set_var("RUST_LOG", "echo=info"); env_logger::init(); @@ -28,4 +29,5 @@ fn main() -> io::Result<()> { HttpService::build().finish(handle_request).tcp() })? .run() + .await } diff --git a/actix-http/examples/hello-world.rs b/actix-http/examples/hello-world.rs index 7d85768699c..4134ee734a5 100644 --- a/actix-http/examples/hello-world.rs +++ b/actix-http/examples/hello-world.rs @@ -6,7 +6,8 @@ use futures::future; use http::header::HeaderValue; use log::info; -fn main() -> io::Result<()> { +#[actix_rt::main] +async fn main() -> io::Result<()> { env::set_var("RUST_LOG", "hello_world=info"); env_logger::init(); @@ -24,4 +25,5 @@ fn main() -> io::Result<()> { .tcp() })? .run() + .await }