Skip to content

Commit 2a5f9b2

Browse files
authored
Merge branch 'master' into body-stream
2 parents 9370048 + f4d8e08 commit 2a5f9b2

File tree

5 files changed

+42
-9
lines changed

5 files changed

+42
-9
lines changed

.github/workflows/ci.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
runs-on: ubuntu-latest
2525
steps:
2626
- name: Checkout
27-
uses: actions/checkout@v3
27+
uses: actions/checkout@v4
2828

2929
- name: Install rust
3030
uses: dtolnay/rust-toolchain@stable
@@ -61,7 +61,7 @@ jobs:
6161

6262
steps:
6363
- name: Checkout
64-
uses: actions/checkout@v3
64+
uses: actions/checkout@v4
6565

6666
- name: Install rust
6767
uses: dtolnay/rust-toolchain@master
@@ -81,10 +81,18 @@ jobs:
8181
runs-on: ubuntu-latest
8282
steps:
8383
- name: Checkout
84-
uses: actions/checkout@v3
84+
uses: actions/checkout@v4
8585

8686
- name: Install Rust
8787
uses: dtolnay/rust-toolchain@nightly
8888

89+
# check for missing docs
90+
- name: cargo check
91+
run: cargo check --all-features
92+
env:
93+
RUSTFLAGS: "--cfg docsrs"
94+
8995
- name: cargo doc
9096
run: cargo rustdoc --all-features -- -D 'rustdoc::broken_intra_doc_links'
97+
env:
98+
RUSTFLAGS: "--cfg docsrs"

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# CHANGELOG
22

3+
### v0.4.1 (August 6, 2025)
4+
5+
- **Fixes**:
6+
- Fix `Server::graceful()` bounds incorrect requiring the filter to be a future.
7+
- Enable `tokio/net` when the `server` feature is enabled.
8+
- Render `cfg`s in the docs.
9+
310
## v0.4.0 (August 5, 2025)
411

512
- **Changes**:

Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "warp"
3-
version = "0.4.0"
3+
version = "0.4.1"
44
description = "serve the web at warp speeds"
55
authors = ["Sean McArthur <[email protected]>"]
66
license = "MIT"
@@ -29,9 +29,9 @@ futures-util = { version = "0.3", default-features = false, features = ["sink"]
2929
futures-channel = { version = "0.3.17", features = ["sink"]}
3030
headers = "0.4"
3131
http = "1"
32-
http-body-util = "0.1"
32+
http-body-util = "0.1.2"
3333
hyper = { version = "1", features = ["server", "http1", "http2"] }
34-
hyper-util = { version = "0.1", features = ["server", "server-graceful", "server-auto", "http1", "http2", "service", "tokio"], optional = true }
34+
hyper-util = { version = "0.1.12", features = ["server", "server-graceful", "server-auto", "http1", "http2", "service", "tokio"], optional = true }
3535
log = "0.4"
3636
mime = "0.3"
3737
mime_guess = "2.0.0"
@@ -63,7 +63,7 @@ tokio-stream = { version = "0.1.1", features = ["net"] }
6363
default = []
6464
multipart = ["dep:multer"]
6565
websocket = ["hyper/client", "hyper/http1", "dep:tokio-tungstenite", "hyper-util/tokio"]
66-
server = ["hyper/server", "hyper/http1", "hyper/http2", "dep:hyper-util"]
66+
server = ["hyper/server", "hyper/http1", "hyper/http2", "dep:hyper-util", "tokio/net"]
6767
test = ["server"]
6868
# tls might come back, uncertain
6969
#tls = ["tokio-rustls", "rustls-pemfile"]

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#![deny(missing_debug_implementations)]
33
#![deny(rust_2018_idioms)]
44
#![cfg_attr(test, deny(warnings))]
5-
#![cfg_attr(docsrs, feature(auto_doc_cfg))]
5+
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
66

77
//! # warp
88
//!

src/server.rs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ where
2828

2929
/// A warp Server ready to filter requests.
3030
///
31+
/// Construct this type using [`serve()`].
32+
///
3133
/// # Unnameable
3234
///
3335
/// This type is publicly available in the docs only.
@@ -102,9 +104,25 @@ where
102104
#[cfg(feature = "tls")]
103105
pub fn tls(self) -> Server<F, accept::Tls<A>, R> {}
104106

107+
/// Add graceful shutdown support to this server.
108+
///
109+
/// # Example
110+
///
111+
/// ```
112+
/// # async fn ex(addr: std::net::SocketAddr) {
113+
/// # use warp::Filter;
114+
/// # let filter = warp::any().map(|| "ok");
115+
/// warp::serve(filter)
116+
/// .bind(addr).await
117+
/// .graceful(async {
118+
/// // some signal in here, such as ctrl_c
119+
/// })
120+
/// .run().await;
121+
/// # }
122+
/// ```
105123
pub fn graceful<Fut>(self, shutdown_signal: Fut) -> Server<F, A, run::Graceful<Fut>>
106124
where
107-
F: Future<Output = ()> + Send + 'static,
125+
Fut: Future<Output = ()> + Send + 'static,
108126
{
109127
Server {
110128
acceptor: self.acceptor,

0 commit comments

Comments
 (0)