reqwest — client HTTP
Intermédiairecargo add reqwest -F json
#[derive(serde::Deserialize, Debug)]
struct Repo { name: String, stargazers_count: u32 }
let client = reqwest::Client::new();
let repo: Repo = client
.get("https://api.github.com/repos/rust-lang/rust")
.header("User-Agent", "mon-app")
.send()
.await?
.error_for_status()?
.json()
.await?;