pub trait Validatable<Key> {
// Required method
fn validate(&self) -> Result<(), ValidationErrors<Key>>;
// Provided method
fn validate_or_empty(&self) -> ValidationErrors<Key> { ... }
}Expand description
An item that can be validated.
Required Methods§
Sourcefn validate(&self) -> Result<(), ValidationErrors<Key>>
fn validate(&self) -> Result<(), ValidationErrors<Key>>
Validate this item. Returns Ok(()) if no errors were
encountered, and returns Err(ValidationErrors) if any errors
were encountered.
Provided Methods§
Sourcefn validate_or_empty(&self) -> ValidationErrors<Key>
fn validate_or_empty(&self) -> ValidationErrors<Key>
Validate this item. Returns an empty ValidationErrors if no errors were encountered during validation.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".