11
reqwest v0.10
source link: https://seanmonstar.com/post/189960517042/reqwest-v010
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
reqwest is a higher-level HTTP client for Rust. Let me introduce you the v0.10
release that adds async
/ await
support!
Some headline features are:
-
Add
std::future::Future
support (helloasync
/await
). - Add experimental WASM support.
-
Change the default client API to async, moving the previous synchronous API to
reqwest::blocking
. -
Make many “extra” features optional to reduce unnecessary dependencies (
blocking
,cookies
,gzip
,json
, etc). - Enable automatic “system” proxy detection.
Here’s a simple streaming example using the new syntax:
async fn example() -> Result<(), Box<dyn std::error::Error>> { let mut resp = reqwest::get("https://hyper.rs").await?; while let Some(chunk) = resp.chunk().await? { stdout().write_all(&chunk).await?; } Ok(()) }
I want to thank all those contributing to make the best Rust HTTP client even better!
Take a look at the changelog for all the details.
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK