use README.md traits to use dynamic library (#695)
This commit is contained in:
committed by
Sean McArthur
parent
3090a68d53
commit
57300edbc4
@@ -26,7 +26,7 @@ Async:
|
|||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() -> Result<(), Box<std::error::Error>> {
|
async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
let resp: HashMap<String, String> = reqwest::get("https://httpbin.org/ip")
|
let resp: HashMap<String, String> = reqwest::get("https://httpbin.org/ip")
|
||||||
.await?
|
.await?
|
||||||
.json()
|
.json()
|
||||||
@@ -41,7 +41,7 @@ Blocking:
|
|||||||
```rust,no_run
|
```rust,no_run
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
fn main() -> Result<(), Box<std::error::Error>> {
|
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
let resp: HashMap<String, String> = reqwest::blocking::get("https://httpbin.org/ip")?
|
let resp: HashMap<String, String> = reqwest::blocking::get("https://httpbin.org/ip")?
|
||||||
.json()?;
|
.json()?;
|
||||||
println!("{:#?}", resp);
|
println!("{:#?}", resp);
|
||||||
|
|||||||
Reference in New Issue
Block a user