pub struct Validator { /* private fields */ }Expand description
Composite validator
Implementations§
Source§impl Validator
impl Validator
Sourcepub fn add_rule(&mut self, name: String, rule: Box<dyn ValidationRule>)
pub fn add_rule(&mut self, name: String, rule: Box<dyn ValidationRule>)
Add a validation rule
Sourcepub fn remove_rule(&mut self, name: &str)
pub fn remove_rule(&mut self, name: &str)
Remove a validation rule
Sourcepub fn validate_all(&self, value: &str) -> SecurityResult<()>
pub fn validate_all(&self, value: &str) -> SecurityResult<()>
Validate a value against all rules
Sourcepub fn validate_with(
&self,
value: &str,
rule_names: &[&str],
) -> SecurityResult<()>
pub fn validate_with( &self, value: &str, rule_names: &[&str], ) -> SecurityResult<()>
Validate against specific rules
Sourcepub fn get_rule_names(&self) -> Vec<String>
pub fn get_rule_names(&self) -> Vec<String>
Get all rule names
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Validator
impl !RefUnwindSafe for Validator
impl Send for Validator
impl Sync for Validator
impl Unpin for Validator
impl !UnwindSafe for Validator
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