Trait semval::Validate

source ·
pub trait Validate {
    type Invalidity: Invalidity;

    fn validate(&self) -> ValidationResult<Self::Invalidity>;
}
Expand description

A trait for validating types

Validation is expected to be an expensive operation that should only be invoked when crossing boundaries between independent components.

Required Associated Types

Invalidity objectives

Required Methods

Perform the validation

Errors

Returns Err with the collected invalidities if one or more validations failed.

Implementations on Foreign Types

Validate is implemented for any reference of a type that implements Validate.

Validate Some or otherwise implicitly evaluate to Ok in case of None

If the absence of an optional value is considered a validation error this must be checked separately.

Validate all elements of a slice

Implementors