remove redundant trait bound; add support for validify
This commit is contained in:
@@ -105,6 +105,15 @@ impl<'v, T: ValidateArgs<'v>> HasValidateArgs<'v> for Form<T> {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "validify")]
|
||||
impl<T: validify::Modify> crate::HasModify for Form<T> {
|
||||
type Modify = T;
|
||||
|
||||
fn get_modify(&mut self) -> &mut Self::Modify {
|
||||
&mut self.0
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::tests::{ValidTest, ValidTestParameter};
|
||||
|
||||
@@ -109,6 +109,15 @@ impl<'v, T: ValidateArgs<'v>> HasValidateArgs<'v> for Protobuf<T> {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "validify")]
|
||||
impl<T: validify::Modify> crate::HasModify for Protobuf<T> {
|
||||
type Modify = T;
|
||||
|
||||
fn get_modify(&mut self) -> &mut Self::Modify {
|
||||
&mut self.0
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::tests::{ValidTest, ValidTestParameter};
|
||||
|
||||
@@ -105,6 +105,15 @@ impl<'v, T: ValidateArgs<'v>> HasValidateArgs<'v> for Query<T> {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "validify")]
|
||||
impl<T: validify::Modify> crate::HasModify for Query<T> {
|
||||
type Modify = T;
|
||||
|
||||
fn get_modify(&mut self) -> &mut Self::Modify {
|
||||
&mut self.0
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::tests::{ValidTest, ValidTestParameter};
|
||||
|
||||
@@ -99,9 +99,11 @@
|
||||
use crate::Garde;
|
||||
#[cfg(feature = "validator")]
|
||||
use crate::{Valid, ValidEx};
|
||||
#[cfg(any(feature = "validator", feature = "garde"))]
|
||||
#[cfg(feature = "validify")]
|
||||
use crate::{Validated, Validified};
|
||||
#[cfg(any(feature = "validator", feature = "garde", feature = "validify"))]
|
||||
use axum_extra::routing::TypedPath;
|
||||
#[cfg(any(feature = "validator", feature = "garde"))]
|
||||
#[cfg(any(feature = "validator", feature = "garde", feature = "validify"))]
|
||||
use std::fmt::Display;
|
||||
|
||||
#[cfg(feature = "validator")]
|
||||
@@ -118,3 +120,13 @@ impl<T: TypedPath + Display, A> TypedPath for ValidEx<T, A> {
|
||||
impl<T: TypedPath + Display> TypedPath for Garde<T> {
|
||||
const PATH: &'static str = T::PATH;
|
||||
}
|
||||
|
||||
#[cfg(feature = "validify")]
|
||||
impl<T: TypedPath + Display> TypedPath for Validated<T> {
|
||||
const PATH: &'static str = T::PATH;
|
||||
}
|
||||
|
||||
#[cfg(feature = "validify")]
|
||||
impl<T: TypedPath + Display> TypedPath for Validified<T> {
|
||||
const PATH: &'static str = T::PATH;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user