Fix stuff.

This commit is contained in:
Kalle Carlbark 2020-03-03 21:07:21 +01:00
parent 6485e0d24f
commit 0e7e0ae773
No known key found for this signature in database
GPG key ID: 5E4BAB01A57CDD62

View file

@ -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(())
}