-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
C-bugCategory: bug. Something is wrong. This is bad!Category: bug. Something is wrong. This is bad!
Description
Platform
Windows 10 64
Description
I don't understand why in a new project with this Cargo.toml:
[package]
name = "demo"
version = "0.1.0"
edition = "2021"
publish = false
[dependencies]
hyper = { version = "0.14.20", features = ["client"] }
tokio = { version = "1.20.1", features = ["full"] }
tracing = { version = "0.1.36", features = ["log"] }I'm getting this error:
error[E0432]: unresolved import `hyper::client::Client`
--> src\main.rs:1:13
|
1 | use hyper::{client::Client, header, Request};
| ^^^^^^^^^^^^^^ no `Client` in `client`
For more information about this error, try `rustc --explain E0432`.
Using the below code:
use hyper::{client::Client, header, Request};
#[tokio::main]
async fn main() {
let hyper_client = Client::new();
let req = Request::builder()
.uri("http://google.com")
.header(header::CONTENT_TYPE, "application/json")
.body(hyper::Body::empty())
.unwrap();
let resp = hyper_client.request(req).await.unwrap();
println!("{:?}", resp);
}It works if I use this line in Cargo.toml instead (full/client):
hyper = { version = "0.14.20", features = ["full"] }
Why?
Metadata
Metadata
Assignees
Labels
C-bugCategory: bug. Something is wrong. This is bad!Category: bug. Something is wrong. This is bad!