Skip to main content

ValidationRule

Trait ValidationRule 

Source
pub trait ValidationRule: Send + Sync {
    // Required method
    fn validate(&self, ctx: &JoinPoint) -> Result<(), String>;

    // Provided method
    fn description(&self) -> &str { ... }
}
Expand description

Validation rule trait.

Implement this trait to create custom validation rules that can be composed and applied to functions.

Required Methods§

Source

fn validate(&self, ctx: &JoinPoint) -> Result<(), String>

Validate the input.

Returns Ok(()) if validation passes, or Err(message) if it fails.

Provided Methods§

Source

fn description(&self) -> &str

Get a description of this validation rule.

Implementors§