From 401787d559f17cd860551b94200fa56f4bcc2811 Mon Sep 17 00:00:00 2001 From: Chrislearn Young Date: Mon, 5 Aug 2024 22:16:34 +0800 Subject: [PATCH] Add with_host fn to Router (#845) --- crates/core/src/routing/router.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/crates/core/src/routing/router.rs b/crates/core/src/routing/router.rs index 03b4d3495..8422b161b 100644 --- a/crates/core/src/routing/router.rs +++ b/crates/core/src/routing/router.rs @@ -257,6 +257,14 @@ impl Router { self.filter(filters::host(host)) } + /// Create a new [`HostFilter`] and set host filter. + /// + /// [`HostFilter`]: super::filters::HostFilter + #[inline] + pub fn with_host(self, host: impl Into) -> Self { + Router::with_filter(filters::host(host)) + } + /// Add a [`PortFilter`] to current router. /// /// [`PortFilter`]: super::filters::PortFilter