Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Client::new requirement not clear #2759

Closed
usupaye opened this issue Feb 13, 2022 · 1 comment · Fixed by #2760
Closed

Client::new requirement not clear #2759

usupaye opened this issue Feb 13, 2022 · 1 comment · Fixed by #2760
Labels
A-docs Area: documentation. E-easy Effort: easy. A task that would be a great starting point for a new contributor.

Comments

@usupaye
Copy link

usupaye commented Feb 13, 2022

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
@usupaye usupaye added the C-bug Category: bug. Something is wrong. This is bad! label Feb 13, 2022
@seanmonstar
Copy link
Member

Ah ok, seems like we can add a doc(cfg(tcp)) to that function.

@seanmonstar seanmonstar added A-docs Area: documentation. E-easy Effort: easy. A task that would be a great starting point for a new contributor. and removed C-bug Category: bug. Something is wrong. This is bad! labels Feb 14, 2022
ilyatrefilov added a commit to ilyatrefilov/hyper that referenced this issue Feb 15, 2022
added cfg attr to denote required tcp feature in docs for Client::new method

Closes: hyperium#2759
seanmonstar pushed a commit that referenced this issue Feb 15, 2022
added cfg attr to denote required tcp feature in docs for Client::new method

Closes: #2759
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-docs Area: documentation. E-easy Effort: easy. A task that would be a great starting point for a new contributor.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants