| use serde::Deserialize; | |
| use reqwest; | |
| struct Todo { | |
| user_id: i32, | |
| id: i32, | |
| title: String, | |
| completed: bool, | |
| } | |
| async fn main() -> Result<(), reqwest::Error> { | |
| let todo: Todo = reqwest::get("https://jsonplaceholder.typicode.com/todos/1") | |
| .await? | |
| .json() | |
| .await?; | |
| println!("{:?}", todo); | |
| Ok(()) | |
| } |