pub struct PropertyValidator { /* private fields */ }Expand description
Property validator with rule-based validation
Implementations§
Source§impl PropertyValidator
impl PropertyValidator
Sourcepub fn add_rule(&mut self, property: PropertyId, rule: ValidationRule)
pub fn add_rule(&mut self, property: PropertyId, rule: ValidationRule)
Add a validation rule for a property
Sourcepub fn validate(&self, id: PropertyId, value: &PropertyValue) -> Result<()>
pub fn validate(&self, id: PropertyId, value: &PropertyValue) -> Result<()>
Validate a property value according to registered rules (instance method)
Sourcepub fn validate_static(id: PropertyId, value: &PropertyValue) -> Result<()>
pub fn validate_static(id: PropertyId, value: &PropertyValue) -> Result<()>
Validate a property value (static method for backward compatibility)
This creates a default validator and validates the value. For better performance with multiple validations, create a PropertyValidator instance and reuse it.
Sourcepub fn check_mutual_exclusion(
&self,
props: &[(PropertyId, PropertyValue)],
) -> Vec<ValidationError>
pub fn check_mutual_exclusion( &self, props: &[(PropertyId, PropertyValue)], ) -> Vec<ValidationError>
Check for mutual exclusion between properties
Sourcepub fn validate_length_range(
id: PropertyId,
value: &PropertyValue,
min: f64,
max: f64,
) -> Result<()>
pub fn validate_length_range( id: PropertyId, value: &PropertyValue, min: f64, max: f64, ) -> Result<()>
Validate length range
Sourcepub fn validate_number_range(
id: PropertyId,
value: &PropertyValue,
min: f64,
max: f64,
) -> Result<()>
pub fn validate_number_range( id: PropertyId, value: &PropertyValue, min: f64, max: f64, ) -> Result<()>
Validate number range
Sourcepub fn validate_percentage_range(
id: PropertyId,
value: &PropertyValue,
min: f32,
max: f32,
) -> Result<()>
pub fn validate_percentage_range( id: PropertyId, value: &PropertyValue, min: f32, max: f32, ) -> Result<()>
Validate percentage range
Sourcepub fn validate_enum(
id: PropertyId,
value: &PropertyValue,
allowed_values: &[u16],
) -> Result<()>
pub fn validate_enum( id: PropertyId, value: &PropertyValue, allowed_values: &[u16], ) -> Result<()>
Validate enum (legacy method for backward compatibility)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PropertyValidator
impl RefUnwindSafe for PropertyValidator
impl Send for PropertyValidator
impl Sync for PropertyValidator
impl Unpin for PropertyValidator
impl UnsafeUnpin for PropertyValidator
impl UnwindSafe for PropertyValidator
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