Trait Constraint

Source
pub trait Constraint<T> {
    // Required method
    fn validate(&self, data: &T) -> ConstraintResult;
}
Expand description

Constraint trait

Required Methods§

Source

fn validate(&self, data: &T) -> ConstraintResult

Validates data to make sure it follows constraints

Implementors§

Source§

impl<T> Constraint<T> for NumberConstraint
where T: Into<i32> + Clone + PartialOrd,

Implementing method to apply constraints on numbers

Source§

impl<T> Constraint<T> for StringConstraint
where T: AsRef<str>,

Implementing method to apply constraints on strings