impl FromRef<()> for ValidationContext<()>
This commit is contained in:
@@ -182,7 +182,7 @@ impl ValidationContext<()> {
|
|||||||
///
|
///
|
||||||
/// fn custom_response(errors: ValidationErrors) -> Response {
|
/// fn custom_response(errors: ValidationErrors) -> Response {
|
||||||
/// // return response with custom status code and body
|
/// // return response with custom status code and body
|
||||||
/// (StatusCode::NOT_FOUND, Json(errors)).into_response()
|
/// (StatusCode::IM_A_TEAPOT, Json(errors)).into_response()
|
||||||
/// }
|
/// }
|
||||||
///
|
///
|
||||||
/// let context = ValidationContext::custom(custom_response);
|
/// let context = ValidationContext::custom(custom_response);
|
||||||
@@ -293,6 +293,12 @@ impl<Arguments> ValidationContext<Arguments> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl FromRef<()> for ValidationContext<()> {
|
||||||
|
fn from_ref(_: &()) -> Self {
|
||||||
|
ValidationContext::default()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// `ValidError` is the error type returned when the `Valid` extractor fails.
|
/// `ValidError` is the error type returned when the `Valid` extractor fails.
|
||||||
///
|
///
|
||||||
/// It has two variants:
|
/// It has two variants:
|
||||||
|
|||||||
Reference in New Issue
Block a user