Fix stuff.
This commit is contained in:
parent
6485e0d24f
commit
0e7e0ae773
1 changed files with 3 additions and 5 deletions
|
@ -1,5 +1,4 @@
|
|||
use serde::{Deserialize};
|
||||
|
||||
use serde::Deserialize;
|
||||
|
||||
#[derive(Deserialize)]
|
||||
struct Ip {
|
||||
|
@ -8,10 +7,9 @@ struct Ip {
|
|||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let resp = reqwest::get("https://api.ipify.org?format=json")
|
||||
.await?;
|
||||
let resp = reqwest::get("https://api.ipify.org?format=json").await?;
|
||||
let body = resp.text().await?;
|
||||
let ip: Ip = serde_json::from_str(&body)?;
|
||||
println!("My IP {}", ip.ip);
|
||||
println!("{}", ip.ip);
|
||||
Ok(())
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue