Usage with async-std? #3055
-
Can use hyper::client::Client;
#[async_std::main]
async fn main() {
// Still inside `async fn main`...
let client = Client::new();
// Parse an `http::Uri`...
let uri = "http://httpbin.org/ip".parse().unwrap();
// Await the response...
let mut resp = client.get(uri).await.unwrap();
println!("Response: {}", resp.status());
} Yields:
Given that both runtimes rely on rather standard rust features ( |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
You can, but you have to adapt it manually to the Alternatively, you can use surf, which uses |
Beta Was this translation helpful? Give feedback.
-
The default |
Beta Was this translation helpful? Give feedback.
The default
Client
uses anHttpConnector
which makes use oftokio::net::TcpStream
s. You can disable the relevant features and bring your own runtime.