Skip to content

Commit

Permalink
Add note about how to use tokio::main in examples (#745)
Browse files Browse the repository at this point in the history
  • Loading branch information
seanmonstar committed Dec 17, 2019
1 parent c4c754c commit f78846b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
3 changes: 3 additions & 0 deletions examples/json_dynamic.rs
Expand Up @@ -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()
Expand Down
3 changes: 3 additions & 0 deletions examples/json_typed.rs
Expand Up @@ -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 {
Expand Down
8 changes: 4 additions & 4 deletions 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());

Expand Down

0 comments on commit f78846b

Please sign in to comment.