Skip to content

Commit aa7ff60

Browse files
committed
docs(client): replace example on mod page with link to guide
1 parent 7cedc13 commit aa7ff60

File tree

1 file changed

+4
-46
lines changed

1 file changed

+4
-46
lines changed

src/client/conn/mod.rs

Lines changed: 4 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -5,56 +5,14 @@
55
//! are not handled at this level. This module provides the building blocks to
66
//! customize those things externally.
77
//!
8-
//! If you are looking for a convenient HTTP client,
9-
//! then you may wish to consider [reqwest](https://github.com/seanmonstar/reqwest)
10-
//! for a high level client or [`hyper-util`'s client](https://docs.rs/hyper-util/latest/hyper_util/client/index.html)
8+
//! If you are looking for a convenient HTTP client, then you may wish to
9+
//! consider [reqwest](https://github.com/seanmonstar/reqwest) for a high level
10+
//! client or [`hyper-util`'s client](https://docs.rs/hyper-util/latest/hyper_util/client/index.html)
1111
//! if you want to keep it more low level / basic.
1212
//!
1313
//! ## Example
1414
//!
15-
//! A simple example that uses the `SendRequest` struct to talk HTTP over some TCP stream.
16-
//!
17-
//! ```no_run
18-
//! # #[cfg(all(feature = "client", feature = "http1"))]
19-
//! # mod rt {
20-
//! use bytes::Bytes;
21-
//! use http::{Request, StatusCode};
22-
//! use http_body_util::Empty;
23-
//! use hyper::client::conn;
24-
//! # use hyper::rt::{Read, Write};
25-
//! # async fn run<I>(tcp: I) -> Result<(), Box<dyn std::error::Error>>
26-
//! # where
27-
//! # I: Read + Write + Unpin + Send + 'static,
28-
//! # {
29-
//! let (mut request_sender, connection) = conn::http1::handshake(tcp).await?;
30-
//!
31-
//! // spawn a task to poll the connection and drive the HTTP state
32-
//! tokio::spawn(async move {
33-
//! if let Err(e) = connection.await {
34-
//! eprintln!("Error in connection: {}", e);
35-
//! }
36-
//! });
37-
//!
38-
//! let request = Request::builder()
39-
//! // We need to manually add the host header because SendRequest does not
40-
//! .header("Host", "example.com")
41-
//! .method("GET")
42-
//! .body(Empty::<Bytes>::new())?;
43-
//!
44-
//! let response = request_sender.send_request(request).await?;
45-
//! assert!(response.status() == StatusCode::OK);
46-
//!
47-
//! let request = Request::builder()
48-
//! .header("Host", "example.com")
49-
//! .method("GET")
50-
//! .body(Empty::<Bytes>::new())?;
51-
//!
52-
//! let response = request_sender.send_request(request).await?;
53-
//! assert!(response.status() == StatusCode::OK);
54-
//! # Ok(())
55-
//! # }
56-
//! # }
57-
//! ```
15+
//! See the [client guide](https://hyper.rs/guides/1/client/basic/).
5816
5917
#[cfg(feature = "http1")]
6018
pub mod http1;

0 commit comments

Comments
 (0)