[−][src]Trait valid::Validate
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.
Implementations on Foreign Types
impl<T> Validate<MustMatch, RelatedFields> for (T, T) where
T: Eq + Into<Value>, [src]
T: Eq + Into<Value>,
fn validate(
self,
fields: impl Into<RelatedFields>,
_constraint: &MustMatch
) -> Validation<MustMatch, Self>[src]
self,
fields: impl Into<RelatedFields>,
_constraint: &MustMatch
) -> Validation<MustMatch, Self>
impl<T> Validate<FromTo, RelatedFields> for (T, T) where
T: PartialOrd + Into<Value>, [src]
T: PartialOrd + Into<Value>,
fn validate(
self,
fields: impl Into<RelatedFields>,
constraint: &FromTo
) -> Validation<FromTo, Self>[src]
self,
fields: impl Into<RelatedFields>,
constraint: &FromTo
) -> Validation<FromTo, Self>
Implementors
impl<'a, T, A> Validate<Contains<'a, A>, FieldName> for T where
T: HasMember<A> + Into<Value>,
A: Clone + Into<Value>, [src]
T: HasMember<A> + Into<Value>,
A: Clone + Into<Value>,
fn validate(
self,
name: impl Into<FieldName>,
constraint: &Contains<'a, A>
) -> Validation<Contains<'a, A>, Self>[src]
self,
name: impl Into<FieldName>,
constraint: &Contains<'a, A>
) -> Validation<Contains<'a, A>, Self>
impl<T> Validate<Bound<T>, FieldName> for T where
T: PartialOrd + Clone + Into<Value>, [src]
T: PartialOrd + Clone + Into<Value>,
fn validate(
self,
name: impl Into<FieldName>,
constraint: &Bound<T>
) -> Validation<Bound<T>, Self>[src]
self,
name: impl Into<FieldName>,
constraint: &Bound<T>
) -> Validation<Bound<T>, Self>
impl<T> Validate<CharCount, FieldName> for T where
T: HasCharCount, [src]
T: HasCharCount,
fn validate(
self,
name: impl Into<FieldName>,
constraint: &CharCount
) -> Validation<CharCount, Self>[src]
self,
name: impl Into<FieldName>,
constraint: &CharCount
) -> Validation<CharCount, Self>
impl<T> Validate<Length, FieldName> for T where
T: HasLength, [src]
T: HasLength,
fn validate(
self,
name: impl Into<FieldName>,
constraint: &Length
) -> Validation<Length, Self>[src]
self,
name: impl Into<FieldName>,
constraint: &Length
) -> Validation<Length, Self>
impl<T> Validate<AssertFalse, FieldName> for T where
T: HasCheckedValue, [src]
T: HasCheckedValue,
fn validate(
self,
name: impl Into<FieldName>,
_constraint: &AssertFalse
) -> Validation<AssertFalse, Self>[src]
self,
name: impl Into<FieldName>,
_constraint: &AssertFalse
) -> Validation<AssertFalse, Self>
impl<T> Validate<AssertTrue, FieldName> for T where
T: HasCheckedValue, [src]
T: HasCheckedValue,
fn validate(
self,
name: impl Into<FieldName>,
_constraint: &AssertTrue
) -> Validation<AssertTrue, Self>[src]
self,
name: impl Into<FieldName>,
_constraint: &AssertTrue
) -> Validation<AssertTrue, Self>
impl<T> Validate<Digits, FieldName> for T where
T: HasDecimalDigits, [src]
T: HasDecimalDigits,
fn validate(
self,
name: impl Into<FieldName>,
constraint: &Digits
) -> Validation<Digits, Self>[src]
self,
name: impl Into<FieldName>,
constraint: &Digits
) -> Validation<Digits, Self>
impl<T> Validate<NotEmpty, FieldName> for T where
T: HasEmptyValue, [src]
T: HasEmptyValue,