diff --git a/src/lib.rs b/src/lib.rs index 795d13c..faa8528 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -182,7 +182,7 @@ impl ValidationContext<()> { /// /// fn custom_response(errors: ValidationErrors) -> Response { /// // 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); @@ -293,6 +293,12 @@ impl ValidationContext { } } +impl FromRef<()> for ValidationContext<()> { + fn from_ref(_: &()) -> Self { + ValidationContext::default() + } +} + /// `ValidError` is the error type returned when the `Valid` extractor fails. /// /// It has two variants: