Skip to main content

Validatable

Trait Validatable 

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

Source

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§

Source

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

Implementors§