pub struct ValidationRule {
pub name: String,
pub description: String,
pub required: bool,
pub numeric_constraint: Option<RangeConstraint<f64>>,
pub integer_constraint: Option<RangeConstraint<i64>>,
pub string_constraint: Option<Vec<String>>,
}Expand description
Parameter validation rule
Fields§
§name: StringParameter name
description: StringDescription of the parameter
required: boolWhether the parameter is required
numeric_constraint: Option<RangeConstraint<f64>>Numeric constraints (for numeric parameters)
integer_constraint: Option<RangeConstraint<i64>>Integer constraints (for integer parameters)
string_constraint: Option<Vec<String>>String constraints (for string parameters)
Implementations§
Source§impl ValidationRule
impl ValidationRule
Sourcepub fn new(name: String, description: String) -> Self
pub fn new(name: String, description: String) -> Self
Create a new validation rule (basic version)
Sourcepub fn with_numeric_constraint(self, constraint: RangeConstraint<f64>) -> Self
pub fn with_numeric_constraint(self, constraint: RangeConstraint<f64>) -> Self
Add numeric constraint
Sourcepub fn with_integer_constraint(self, constraint: RangeConstraint<i64>) -> Self
pub fn with_integer_constraint(self, constraint: RangeConstraint<i64>) -> Self
Add integer constraint
Sourcepub fn with_string_constraint(self, allowed_values: Vec<String>) -> Self
pub fn with_string_constraint(self, allowed_values: Vec<String>) -> Self
Add string constraint (allowed values)
Trait Implementations§
Source§impl Clone for ValidationRule
impl Clone for ValidationRule
Source§fn clone(&self) -> ValidationRule
fn clone(&self) -> ValidationRule
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ValidationRule
impl RefUnwindSafe for ValidationRule
impl Send for ValidationRule
impl Sync for ValidationRule
impl Unpin for ValidationRule
impl UnwindSafe for ValidationRule
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more