[][src]Trait valid::Validate

pub trait Validate<C, S> where
    S: Context,
    Self: Sized
{ fn validate(
        self,
        context: impl Into<S>,
        constraint: &C
    ) -> Validation<C, Self>; }

The validation function validates whether the given value complies to the specified constraint.

It returns a Validation value that may be used to perform further validations using its combinator methods and or and_then or get the final result by calling the result method.

The context provides additional information to perform the validation, for example a lookup table or some state information. It may also hold parameters needed to provide additional parameters to the error in case of a constraint violation. (see the crate level documentation for more details on how to use the context)

see the crate level documentation for details about how to implement a the Validate trait for custom constraints and custom types.

Required methods

fn validate(self, context: impl Into<S>, constraint: &C) -> Validation<C, Self>

Validates this value for being compliant to the specified constraint C in the given context S.

Loading content...

Implementations on Foreign Types

impl<T> Validate<MustMatch, RelatedFields> for (T, T) where
    T: PartialEq + Into<Value>, 
[src]

impl<T> Validate<MustDefineRange, RelatedFields> for (T, T) where
    T: PartialOrd + Into<Value>, 
[src]

impl Validate<Pattern, FieldName> for String[src]

Loading content...

Implementors

impl<'a, T, A> Validate<Contains<'a, A>, FieldName> for T where
    T: HasMember<A> + Into<Value>,
    A: Clone + Into<Value>, 
[src]

impl<T> Validate<Bound<T>, FieldName> for T where
    T: PartialOrd + Clone + Into<Value>, 
[src]

impl<T> Validate<CharCount, FieldName> for T where
    T: HasCharCount
[src]

impl<T> Validate<Length, FieldName> for T where
    T: HasLength
[src]

impl<T> Validate<AssertFalse, FieldName> for T where
    T: HasCheckedValue
[src]

impl<T> Validate<AssertTrue, FieldName> for T where
    T: HasCheckedValue
[src]

impl<T> Validate<Digits, FieldName> for T where
    T: HasDecimalDigits
[src]

impl<T> Validate<NonZero, FieldName> for T where
    T: HasZeroValue + Into<Value>, 
[src]

impl<T> Validate<NotEmpty, FieldName> for T where
    T: HasEmptyValue
[src]

Loading content...