Download rust/src/api_request.rs from neopilot/PyRs2: direct link, hf CLI and curl.
- Browser
- Download file 424 Bytes
-
https://huggingface.co/datasets/neopilot/PyRs2/resolve/main/rust/src/api_request.rs
- Command line
-
hf download hf://datasets/neopilot/PyRs2/rust/src/api_request.rs
-
curl -L -o api_request.rs https://huggingface.co/datasets/neopilot/PyRs2/resolve/main/rust/src/api_request.rs
424 Bytes
| 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(()) | |
| } |