Trait gotham_formdata::validate::Validator [−][src]
Expand description
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
Required methods
Implementations on Foreign Types
Implementors
impl<'a, D, T> Validator<D> for ExpectedValidator<'a, T> where
D: PartialEq<T>,
[src]
impl<'a, D, T> Validator<D> for ExpectedValidator<'a, T> where
D: PartialEq<T>,
[src]impl<'re, T: AsRef<str>> Validator<T> for RegexValidator<'re>
[src]
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]
impl<F, Err, T: ?Sized> Validator<T> for F where
F: Fn(&T) -> Result<(), Err>,
[src]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]
impl<I, T> Validator<T> for MaxValidator<I> where
I: Debug + Display + PartialOrd,
T: Clone + Into<I>,
[src]impl<I, T> Validator<T> for MinValidator<I> where
I: Debug + Display + PartialOrd,
T: Clone + Into<I>,
[src]
impl<I, T> Validator<T> for MinValidator<I> where
I: Debug + Display + PartialOrd,
T: Clone + Into<I>,
[src]impl<T: AsRef<str>> Validator<T> for MaxLengthValidator
[src]
impl<T: AsRef<str>> Validator<T> for MaxLengthValidator
[src]impl<T: AsRef<str>> Validator<T> for MinLengthValidator
[src]
impl<T: AsRef<str>> Validator<T> for MinLengthValidator
[src]