Trait constrained_inputs::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