Datasets:

Modalities:
Text
Formats:
text
Size:
< 1K
Libraries:
Datasets
License:
PyRs2 / rust /src /api_request.rs
khulnasoft's picture
Upload folder using huggingface_hub
998b6cc verified
raw
history blame contribute delete
424 Bytes
use serde::Deserialize;
use reqwest;
#[derive(Deserialize, Debug)]
struct Todo {
#[serde(rename = "userId")]
user_id: i32,
id: i32,
title: String,
completed: bool,
}
#[tokio::main]
async fn main() -> Result<(), reqwest::Error> {
let todo: Todo = reqwest::get("https://jsonplaceholder.typicode.com/todos/1")
.await?
.json()
.await?;
println!("{:?}", todo);
Ok(())
}