Skip to main content

Constraint

Trait Constraint 

Source
pub trait Constraint: Send + Sync {
    // Required methods
    fn code(&self) -> &'static str;
    fn validate(
        &self,
        value: &str,
        property_path: &str,
        violations: &mut ConstraintViolationList,
    );
}
Expand description

A rule that may append violations for a value.

Required Methods§

Source

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

Stable constraint code (for example NotBlank).

Source

fn validate( &self, value: &str, property_path: &str, violations: &mut ConstraintViolationList, )

Validates value for property_path, appending to violations on failure.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§