Skip to content

Commit

Permalink
fix: Fix with_host and add with_port
Browse files Browse the repository at this point in the history
  • Loading branch information
chrislearn committed Sep 25, 2024
1 parent 9359ccd commit fdfc62b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion crates/core/src/routing/router.rs
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ impl Router {
///
/// [`HostFilter`]: super::filters::HostFilter
#[inline]
pub fn with_host(self, host: impl Into<String>) -> Self {
pub fn with_host(host: impl Into<String>) -> Self {
Router::with_filter(filters::host(host))
}

Expand All @@ -276,6 +276,14 @@ impl Router {
self.filter(filters::port(port))
}

/// Create a new [`PortFilter`] and set port filter.
///
/// [`PortFilter`]: super::filters::PortFilter
#[inline]
pub fn with_port(port: u16) -> Self {
Router::with_filter(filters::port(port))
}

/// Create a new child router with [`MethodFilter`] to filter get method and set this child router's handler.
///
/// [`MethodFilter`]: super::filters::MethodFilter
Expand Down

0 comments on commit fdfc62b

Please sign in to comment.