Trait ValidationRule

Source
pub trait ValidationRule: Send + Sync {
    // Required methods
    fn validate(&self, value: &Value) -> Result<()>;
    fn message(&self) -> String;
    fn name(&self) -> &'static str;
}
Expand description

Trait for validation rules

Required Methods§

Source

fn validate(&self, value: &Value) -> Result<()>

Validates the given value

Source

fn message(&self) -> String

Returns the error message for validation failure

Source

fn name(&self) -> &'static str

Rule name

Implementors§