Don't expose hidden 'Route' collider methods.

This commit is contained in:
Sergio Benitez 2021-03-20 03:04:31 -07:00
parent b3021e2acb
commit 81346e5949
1 changed files with 7 additions and 8 deletions

View File

@ -16,16 +16,16 @@ impl Route {
/// ///
/// Because query parsing is lenient, and dynamic query parameters can be /// Because query parsing is lenient, and dynamic query parameters can be
/// missing, queries do not impact whether two routes collide. /// missing, queries do not impact whether two routes collide.
#[doc(hidden)] pub(crate) fn collides_with(&self, other: &Route) -> bool {
pub fn collides_with(&self, other: &Route) -> bool {
self.method == other.method self.method == other.method
&& self.rank == other.rank && self.rank == other.rank
&& paths_collide(self, other) && paths_collide(self, other)
&& formats_collide(self, other) && formats_collide(self, other)
} }
/// Determines if this route matches against the given request. This means /// Determines if this route matches against the given request.
/// that: ///
/// This means that:
/// ///
/// * The route's method matches that of the incoming request. /// * The route's method matches that of the incoming request.
/// * The route's format (if any) matches that of the incoming request. /// * The route's format (if any) matches that of the incoming request.
@ -34,10 +34,9 @@ impl Route {
/// * All static components in the route's path match the corresponding /// * All static components in the route's path match the corresponding
/// components in the same position in the incoming request. /// components in the same position in the incoming request.
/// * All static components in the route's query string are also in the /// * All static components in the route's query string are also in the
/// request query string, though in any position. /// request query string, though in any position. If there is no query
/// - If no query in route, requests with/without queries match. /// in the route, requests with/without queries match.
#[doc(hidden)] pub(crate) fn matches(&self, req: &Request<'_>) -> bool {
pub fn matches(&self, req: &Request<'_>) -> bool {
self.method == req.method() self.method == req.method()
&& paths_match(self, req) && paths_match(self, req)
&& queries_match(self, req) && queries_match(self, req)