Support extracting URL params multiple times (#15)

Useful when building higher order extractors.
This commit is contained in:
David Pedersen
2021-06-13 13:06:33 +02:00
committed by GitHub
parent 2b360a7873
commit c41c9e0f78
6 changed files with 69 additions and 36 deletions
-19
View File
@@ -127,13 +127,6 @@ define_rejection! {
pub struct MissingRouteParams;
}
define_rejection! {
#[status = INTERNAL_SERVER_ERROR]
#[body = "Cannot have two URL capture extractors for a single handler"]
/// Rejection type used if you try and extract the URL params more than once.
pub struct UrlParamsAlreadyExtracted;
}
define_rejection! {
#[status = INTERNAL_SERVER_ERROR]
#[body = "Cannot have two request body extractors for a single handler"]
@@ -288,17 +281,6 @@ composite_rejection! {
}
}
composite_rejection! {
/// Rejection used for [`UrlParamsMap`](super::UrlParamsMap).
///
/// Contains one variant for each way the [`UrlParamsMap`](super::UrlParamsMap) extractor
/// can fail.
pub enum UrlParamsMapRejection {
UrlParamsAlreadyExtracted,
MissingRouteParams,
}
}
composite_rejection! {
/// Rejection used for [`UrlParams`](super::UrlParams).
///
@@ -306,7 +288,6 @@ composite_rejection! {
/// can fail.
pub enum UrlParamsRejection {
InvalidUrlParam,
UrlParamsAlreadyExtracted,
MissingRouteParams,
}
}