Skip to main content

Validate

Trait Validate 

Source
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§

Source

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".

Implementors§