From 79a49cd89d31aece2dcb7b369aba58cd5f7cd7bb Mon Sep 17 00:00:00 2001 From: Sean McArthur Date: Tue, 17 Dec 2019 12:27:43 -0800 Subject: [PATCH] Add note about how to use tokio::main in examples --- examples/json_dynamic.rs | 3 +++ examples/json_typed.rs | 3 +++ examples/simple.rs | 8 ++++---- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/examples/json_dynamic.rs b/examples/json_dynamic.rs index 5673420fe..0ec47d680 100644 --- a/examples/json_dynamic.rs +++ b/examples/json_dynamic.rs @@ -4,6 +4,9 @@ //! really care about the structure of the JSON and just need to display it or //! process it at runtime. +// This is using the `tokio` runtime. You'll need the following dependency: +// +// `tokio = { version = "0.2", features = ["macros"] }` #[tokio::main] async fn main() -> Result<(), reqwest::Error> { let echo_json: serde_json::Value = reqwest::Client::new() diff --git a/examples/json_typed.rs b/examples/json_typed.rs index 16a329fbe..44bc608d9 100644 --- a/examples/json_typed.rs +++ b/examples/json_typed.rs @@ -15,6 +15,9 @@ struct Post { user_id: i32, } +// This is using the `tokio` runtime. You'll need the following dependency: +// +// `tokio = { version = "0.2", features = ["macros"] }` #[tokio::main] async fn main() -> Result<(), reqwest::Error> { let new_post = Post { diff --git a/examples/simple.rs b/examples/simple.rs index 0652cbf50..b5a9adcd4 100644 --- a/examples/simple.rs +++ b/examples/simple.rs @@ -1,11 +1,11 @@ #![deny(warnings)] +// This is using the `tokio` runtime. You'll need the following dependency: +// +// `tokio = { version = "0.2", features = ["macros"] }` #[tokio::main] async fn main() -> Result<(), reqwest::Error> { - let res = reqwest::Client::new() - .get("https://hyper.rs") - .send() - .await?; + let res = reqwest::get("https://hyper.rs").await?; println!("Status: {}", res.status());