Skip to content

Client::new requirement not clear #2759

@usupaye

Description

@usupaye

Version
hyper 0.14(.17)

Description
In the documentation, it is not clear that the function Client::new needs the tcp feature enable, otherwise it would throw an function not found error

Example
Cargo.toml:

[package]
name = "hyper_test"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
hyper = { version = "0.14", features = ["client", "http1", "http2"] }

main.rs:

use hyper::client::Client;

fn main() {
    let client = Client::new();
}

output:

error[E0599]: no function or associated item named `new` found for struct `Client` in the current scope
 --> src/main.rs:4:26
  |
4 |     let client = Client::new();
  |                          ^^^ function or associated item not found in `Client<_, _>`

For more information about this error, try `rustc --explain E0599`.
error: could not compile `hyper_test` due to previous error

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-docsArea: documentation.E-easyEffort: easy. A task that would be a great starting point for a new contributor.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions