Add note about how to use tokio::main in examples (#745)
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user