发布于 2021-04-05 10:19:54
Hyper要求您处理较低级别的详细信息,例如解析URI (例如来自文档):
let client = Client::new();
let uri = "http://httpbin.org/ip".parse()?;
let mut resp = client.get(uri).await?;
while let Some(chunk) = resp.body_mut().data().await {
stdout().write_all(&chunk?).await?;
}当reqwest为您处理这个问题时(来自docs.rs):
let body = reqwest::get("https://www.rust-lang.org")
.await?
.text()
.await?;https://stackoverflow.com/questions/66948332
复制相似问题