pub trait Validate: Sized {
type Raw;
// Required method
fn validate(raw: Self::Raw) -> Result<Self, ValidationError>;
}Expand description
The Validate trait provides a general data validation interface.
The Validate trait is used to validate raw data and convert it into a
validated data type. The raw data is passed to the validate function,
which returns a Result containing either the validated data or an error.
Required Associated Types§
Required Methods§
Sourcefn validate(raw: Self::Raw) -> Result<Self, ValidationError>
fn validate(raw: Self::Raw) -> Result<Self, ValidationError>
Validates the raw data and returns the validated data or an error.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.