From e4f7847390e408d74458168118e7a1293be3068b Mon Sep 17 00:00:00 2001 From: ranger-ross Date: Sun, 11 Aug 2024 11:10:00 +0900 Subject: [PATCH] Used def macro in custom --- src/custom.rs | 31 ++----------------------------- 1 file changed, 2 insertions(+), 29 deletions(-) diff --git a/src/custom.rs b/src/custom.rs index dbd70ee..df486fb 100644 --- a/src/custom.rs +++ b/src/custom.rs @@ -4,6 +4,7 @@ //! For usage examples, see the documentation for [`Validated`] //! +use crate::validated_definition; use actix_web::dev::{ServiceFactory, ServiceRequest}; use actix_web::http::StatusCode; use actix_web::FromRequest; @@ -59,35 +60,7 @@ impl Display for ValidationError { /// ``` pub struct Validated(pub T); -impl Validated { - pub fn into_inner(self) -> T { - self.0 - } -} - -impl std::ops::Deref for Validated { - type Target = T; - - fn deref(&self) -> &Self::Target { - &self.0 - } -} - -impl std::ops::DerefMut for Validated { - fn deref_mut(&mut self) -> &mut Self::Target { - &mut self.0 - } -} - -impl Debug for Validated -where - T: Debug, -{ - #[inline] - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - f.debug_tuple("Validated").field(&self.0).finish() - } -} +validated_definition!(); pub struct ValidatedFut { req: actix_web::HttpRequest,