pub struct ValidationRules {
pub allowed_patterns: Vec<Regex>,
pub forbidden_patterns: Vec<Regex>,
pub deprecated_classes: HashSet<String>,
pub class_conflicts: HashMap<String, HashSet<String>>,
pub required_classes: HashMap<String, HashSet<String>>,
}
Expand description
Validation rules for class validation
Fields§
§allowed_patterns: Vec<Regex>
Allowed class patterns
forbidden_patterns: Vec<Regex>
Forbidden class patterns
deprecated_classes: HashSet<String>
Deprecated classes
class_conflicts: HashMap<String, HashSet<String>>
Class conflicts (classes that can’t be used together)
required_classes: HashMap<String, HashSet<String>>
Required classes (classes that must be present when certain classes are used)
Implementations§
Source§impl ValidationRules
impl ValidationRules
Sourcepub fn add_allowed_pattern(&mut self, pattern: Regex)
pub fn add_allowed_pattern(&mut self, pattern: Regex)
Add a custom allowed pattern
Sourcepub fn add_forbidden_pattern(&mut self, pattern: Regex)
pub fn add_forbidden_pattern(&mut self, pattern: Regex)
Add a custom forbidden pattern
Sourcepub fn add_deprecated_class(&mut self, class: String)
pub fn add_deprecated_class(&mut self, class: String)
Add a deprecated class
Sourcepub fn add_class_conflict(&mut self, group: String, class: String)
pub fn add_class_conflict(&mut self, group: String, class: String)
Add a class conflict
Sourcepub fn add_required_class(&mut self, class: String, required: String)
pub fn add_required_class(&mut self, class: String, required: String)
Add a required class
Trait Implementations§
Source§impl Clone for ValidationRules
impl Clone for ValidationRules
Source§fn clone(&self) -> ValidationRules
fn clone(&self) -> ValidationRules
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 moreSource§impl Debug for ValidationRules
impl Debug for ValidationRules
Auto Trait Implementations§
impl Freeze for ValidationRules
impl RefUnwindSafe for ValidationRules
impl Send for ValidationRules
impl Sync for ValidationRules
impl Unpin for ValidationRules
impl UnwindSafe for ValidationRules
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