From c0431c6a26c7934057e88bcf13bbeeb36dd0034e Mon Sep 17 00:00:00 2001 From: tottoto Date: Mon, 6 Nov 2023 21:02:26 +0900 Subject: [PATCH 1/3] chore(ci): fix rustfmt edition to 2018 (#3389) --- .github/workflows/CI.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index aae0db6fcf..3ba2aa2459 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -43,8 +43,8 @@ jobs: - name: cargo fmt --check run: | - if ! rustfmt --check --edition 2021 $(git ls-files '*.rs'); then - printf "Please run \`rustfmt --edition 2021 \$(git ls-files '*.rs')\` to fix rustfmt errors.\nSee CONTRIBUTING.md for more details.\n" >&2 + if ! rustfmt --check --edition 2018 $(git ls-files '*.rs'); then + printf "Please run \`rustfmt --edition 2018 \$(git ls-files '*.rs')\` to fix rustfmt errors.\nSee CONTRIBUTING.md for more details.\n" >&2 exit 1 fi From 776e8debc5104269217cf140bcb4fa9b26e847a3 Mon Sep 17 00:00:00 2001 From: "Herman J. Radtke III" Date: Mon, 6 Nov 2023 08:19:55 -0500 Subject: [PATCH 2/3] docs(server): add conn::http1::Builder example (#3390) --- src/server/conn/http1.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/server/conn/http1.rs b/src/server/conn/http1.rs index c498636ff9..c3a4f724ff 100644 --- a/src/server/conn/http1.rs +++ b/src/server/conn/http1.rs @@ -44,6 +44,25 @@ pin_project_lite::pin_project! { /// /// **Note**: The default values of options are *not considered stable*. They /// are subject to change at any time. +/// +/// # Example +/// +/// ``` +/// # use std::time::Duration; +/// # use hyper::server::conn::http1::Builder; +/// # fn main() { +/// let mut http = Builder::new(); +/// // Set options one at a time +/// http.header_read_timeout(Duration::from_millis(200)); +/// +/// // Or, chain multiple options +/// http.keep_alive(false).title_case_headers(true).max_buf_size(8192); +/// +/// # } +/// ``` +/// +/// Use [`Builder::serve_connection`](struct.Builder.html#method.serve_connection) +/// to bind the built connection to a service. #[derive(Clone, Debug)] pub struct Builder { timer: Time, From 55717111e651c3ebabcb8d3260f48f3153d6529a Mon Sep 17 00:00:00 2001 From: Fangdun Tsai Date: Tue, 7 Nov 2023 00:18:27 +0800 Subject: [PATCH 3/3] docs(client): add example links (#3385) --- src/client/mod.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/client/mod.rs b/src/client/mod.rs index 4282b53c9c..86e3897388 100644 --- a/src/client/mod.rs +++ b/src/client/mod.rs @@ -2,10 +2,14 @@ //! //! hyper provides HTTP over a single connection. See the [`conn`] module. //! -//! ## Example +//! ## Examples //! -//! For a small example program simply fetching a URL, take a look at the -//! [full client example](https://github.com/hyperium/hyper/blob/master/examples/client.rs). +//! * [`client`] - A simple CLI http client that requests the url passed in parameters and outputs the response content and details to the stdout, reading content chunk-by-chunk. +//! +//! * [`client_json`] - A simple program that GETs some json, reads the body asynchronously, parses it with serde and outputs the result. +//! +//! [`client`]: https://github.com/hyperium/hyper/blob/master/examples/client.rs +//! [`client_json`]: https://github.com/hyperium/hyper/blob/master/examples/client_json.rs #[cfg(test)] mod tests;