Trait Validate

Source
pub trait Validate {
    type ValidationError;

    // Required method
    fn validate(&self) -> Result<(), NonEmpty<Self::ValidationError>>;
}
Expand description

An object that can validate itself.

Such an object is either valid, a state which carries no additional information, or is invalid, a state described by a nonempty list of validation errors.

Required Associated Types§

Source

type ValidationError

The type of a validation error.

This type should usually implement std::error::Error, though that is not required.

Required Methods§

Source

fn validate(&self) -> Result<(), NonEmpty<Self::ValidationError>>

Validates the object.

Implementors§