pub trait Validate {
// Required method
fn validate(&self) -> Result<(), ValidationError>;
}Expand description
A domain-shaped validation check on a deserialized body. Keep it cheap and synchronous: structural and range checks, not I/O. Business rules that need ports belong in the application layer, not here.
Required Methods§
Sourcefn validate(&self) -> Result<(), ValidationError>
fn validate(&self) -> Result<(), ValidationError>
Returns Ok(()) when the value is acceptable, or a human-readable reason
why it is not.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".