reqwest is a Rust library for making HTTP requests. Its Client can send POST, GET, DELETE, and other HTTP actions, making it useful when a program needs to communicate with a server. section 17.7.1 section 19.1
A Client can be stored inside another struct and created with Client::default(). Calling get() accepts values such as &str and String that can become URLs, then returns a RequestBuilder. The builder provides configuration methods such as timeout(), body(), and headers(), followed by send(). section 19.1
Making a GET request
use reqwest::Client; fn main() { let client = Client::default(); client.get("https://www.rust-lang.org").send().unwrap(); } This first attempt fails because the asynchronous Client returns a Future rather than an immediate Result. The compiler suggests awaiting the Future before calling unwrap().
The ordinary reqwest::Client is asynchronous, so send() produces a Future<Output = Result<Response, reqwest::Error>>. For a small number of requests without async code, reqwest::blocking::Client offers a simpler alternative. If blocking is unavailable, the reqwest dependency needs the feature that exposes it. section 19.1
