Struct pact_models::matchingrules::MatchingRules
source · pub struct MatchingRules {
pub rules: HashMap<Category, MatchingRuleCategory>,
}
Expand description
Data structure for representing a collection of matchers
Fields§
§rules: HashMap<Category, MatchingRuleCategory>
Categories of matching rules
Implementations§
source§impl MatchingRules
impl MatchingRules
sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
If the matching rules are empty (that is there are no rules assigned to any categories)
sourcepub fn is_not_empty(&self) -> bool
pub fn is_not_empty(&self) -> bool
If the matching rules are not empty (that is there is at least one rule assigned to a category)
sourcepub fn add_category<S>(&mut self, category: S) -> &mut MatchingRuleCategory
pub fn add_category<S>(&mut self, category: S) -> &mut MatchingRuleCategory
Adds the category to the map of rules
sourcepub fn categories(&self) -> HashSet<Category>
pub fn categories(&self) -> HashSet<Category>
Returns all the category names in this rule set
sourcepub fn rules_for_category<S>(&self, category: S) -> Option<MatchingRuleCategory>
pub fn rules_for_category<S>(&self, category: S) -> Option<MatchingRuleCategory>
Returns the category of rules for a given category name
sourcepub fn matcher_is_defined<S>(&self, category: S, path: &Vec<&str>) -> bool
pub fn matcher_is_defined<S>(&self, category: S, path: &Vec<&str>) -> bool
If there is a matcher defined for the category and path
sourcepub fn wildcard_matcher_is_defined<S>(
&self,
category: S,
path: &Vec<&str>
) -> bool
pub fn wildcard_matcher_is_defined<S>( &self, category: S, path: &Vec<&str> ) -> bool
If there is a wildcard matcher defined for the category and path
sourcepub fn type_matcher_defined<S>(&self, category: S, path: &Vec<&str>) -> bool
pub fn type_matcher_defined<S>(&self, category: S, path: &Vec<&str>) -> bool
If there is a type matcher defined for the category and path
sourcepub fn resolve_matchers<S>(
&self,
category: S,
path: &Vec<&str>
) -> Option<MatchingRuleCategory>
pub fn resolve_matchers<S>( &self, category: S, path: &Vec<&str> ) -> Option<MatchingRuleCategory>
Returns a Category
filtered with all rules that match the given path.
sourcepub fn resolve_body_matchers_by_path(&self, path: &Vec<&str>) -> RuleList
pub fn resolve_body_matchers_by_path(&self, path: &Vec<&str>) -> RuleList
Returns a list of rules from the body category that match the given path
sourcepub fn rename<S>(&self, old_name: S, new_name: S) -> Self
pub fn rename<S>(&self, old_name: S, new_name: S) -> Self
Clones the matching rules, renaming the category
sourcepub fn add_rules<S>(&mut self, category: S, rules: MatchingRuleCategory)
pub fn add_rules<S>(&mut self, category: S, rules: MatchingRuleCategory)
Add the rules to the category
sourcepub fn merge(&mut self, other: &MatchingRules)
pub fn merge(&mut self, other: &MatchingRules)
Merge the rules from the other matching rules into this one.
Trait Implementations§
source§impl Clone for MatchingRules
impl Clone for MatchingRules
source§fn clone(&self) -> MatchingRules
fn clone(&self) -> MatchingRules
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for MatchingRules
impl Debug for MatchingRules
source§impl Default for MatchingRules
impl Default for MatchingRules
source§impl Hash for MatchingRules
impl Hash for MatchingRules
source§impl PartialEq for MatchingRules
impl PartialEq for MatchingRules
impl Eq for MatchingRules
Auto Trait Implementations§
impl Freeze for MatchingRules
impl RefUnwindSafe for MatchingRules
impl Send for MatchingRules
impl Sync for MatchingRules
impl Unpin for MatchingRules
impl UnwindSafe for MatchingRules
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
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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>
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