Rename methods to make them easier to read

This commit is contained in:
Matthew Pomes 2023-08-31 17:44:20 -05:00 committed by Sergio Benitez
parent c410871400
commit ca8e40963d
1 changed files with 5 additions and 5 deletions

View File

@ -192,16 +192,16 @@ macro_rules! pub_response_impl {
#[doc = $doc_prelude] #[doc = $doc_prelude]
/// # Client::_test_with(|r| r.mount("/", routes![index]), |_, _, response| { /// # Client::_test_with(|r| r.mount("/", routes![index]), |_, _, response| {
/// let response: LocalResponse = response; /// let response: LocalResponse = response;
/// assert!(response.routed_by::<index>()); /// assert!(response.was_routed_by::<index>());
/// # }); /// # });
/// ``` /// ```
/// ///
/// # Other Route types /// # Other Route types
/// ///
/// [`FileServer`](crate::fs::FileServer) implementes `RouteType`, so a route that should /// [`FileServer`](crate::fs::FileServer) implementes `RouteType`, so a route that should
/// return a static file can be checked against it. Libraries which provide a Route type should /// return a static file can be checked against it. Libraries which provide custom Routes should
/// implement `RouteType`, see [`RouteType`](crate::route::RouteType) for more information. /// implement `RouteType`, see [`RouteType`](crate::route::RouteType) for more information.
pub fn routed_by<T: crate::route::RouteType>(&self) -> bool { pub fn was_routed_by<T: crate::route::RouteType>(&self) -> bool {
if let Some(route_type) = self._request().route().map(|r| r.route_type).flatten() { if let Some(route_type) = self._request().route().map(|r| r.route_type).flatten() {
route_type == std::any::TypeId::of::<T>() route_type == std::any::TypeId::of::<T>()
} else { } else {
@ -220,14 +220,14 @@ macro_rules! pub_response_impl {
#[doc = $doc_prelude] #[doc = $doc_prelude]
/// # Client::_test_with(|r| r.register("/", catchers![default_404]), |_, _, response| { /// # Client::_test_with(|r| r.register("/", catchers![default_404]), |_, _, response| {
/// let response: LocalResponse = response; /// let response: LocalResponse = response;
/// assert!(response.caught_by::<default_404>()); /// assert!(response.was_caught_by::<default_404>());
/// # }); /// # });
/// ``` /// ```
/// ///
/// # Rocket's default catcher /// # Rocket's default catcher
/// ///
/// The default catcher has a `CatcherType` of [`DefaultCatcher`](crate::catcher::DefaultCatcher) /// The default catcher has a `CatcherType` of [`DefaultCatcher`](crate::catcher::DefaultCatcher)
pub fn caught_by<T: crate::catcher::CatcherType>(&self) -> bool { pub fn was_caught_by<T: crate::catcher::CatcherType>(&self) -> bool {
if let Some(catcher_type) = self._request().catcher().map(|r| r.catcher_type).flatten() { if let Some(catcher_type) = self._request().catcher().map(|r| r.catcher_type).flatten() {
catcher_type == std::any::TypeId::of::<T>() catcher_type == std::any::TypeId::of::<T>()
} else { } else {