[−][src]Trait gotham_formdata::validate::Validator
This trait allows data of type T
to be verified against custom criteria.
Example:
use gotham_formdata::FormData; fn validate_password(password: &String) -> Result<(), &'static str> { if password.len() < 8 { return Err("Password is too short"); } Ok(()) } #[derive(FormData)] struct LoginData { username: String, #[validate(validator = validate_password)] password: String }
Associated Types
Loading content...Required methods
Loading content...Implementations on Foreign Types
impl<T: ?Sized> Validator<T> for ()
[src]
Convert ()
into an allways accepting validator.
type Err = Infallible
pub fn validate(self, _: &T) -> Result<(), Infallible>
[src]
Implementors
impl<'a, D, T> Validator<D> for ExpectedValidator<'a, T> where
D: PartialEq<T>,
[src]
D: PartialEq<T>,
impl<'re, T: AsRef<str>> Validator<T> for RegexValidator<'re>
[src]
impl<F, Err, T: ?Sized> Validator<T> for F where
F: Fn(&T) -> Result<(), Err>,
[src]
F: Fn(&T) -> Result<(), Err>,
Convert any function with the correct signature into a validator.
impl<I, T> Validator<T> for MaxValidator<I> where
I: Debug + Display + PartialOrd,
T: Clone + Into<I>,
[src]
I: Debug + Display + PartialOrd,
T: Clone + Into<I>,
impl<I, T> Validator<T> for MinValidator<I> where
I: Debug + Display + PartialOrd,
T: Clone + Into<I>,
[src]
I: Debug + Display + PartialOrd,
T: Clone + Into<I>,