Trait pact_matching::MatchingContext

source ·
pub trait MatchingContext: Debug {
    // Required methods
    fn matcher_is_defined(&self, path: &DocPath) -> bool;
    fn select_best_matcher(&self, path: &DocPath) -> RuleList;
    fn type_matcher_defined(&self, path: &DocPath) -> bool;
    fn values_matcher_defined(&self, path: &DocPath) -> bool;
    fn direct_matcher_defined(
        &self,
        path: &DocPath,
        matchers: &HashSet<&str>
    ) -> bool;
    fn match_keys(
        &self,
        path: &DocPath,
        expected: &BTreeSet<String>,
        actual: &BTreeSet<String>
    ) -> Result<(), Vec<CommonMismatch>>;
    fn plugin_configuration(&self) -> &HashMap<String, PluginInteractionConfig>;
    fn matchers(&self) -> &MatchingRuleCategory;
    fn config(&self) -> DiffConfig;
    fn clone_with(
        &self,
        matchers: &MatchingRuleCategory
    ) -> Box<dyn MatchingContext + Send + Sync>;
}
Expand description

Context used to apply matching logic

Required Methods§

source

fn matcher_is_defined(&self, path: &DocPath) -> bool

If there is a matcher defined at the path in this context

source

fn select_best_matcher(&self, path: &DocPath) -> RuleList

Selected the best matcher from the context for the given path

source

fn type_matcher_defined(&self, path: &DocPath) -> bool

If there is a type matcher defined at the path in this context

source

fn values_matcher_defined(&self, path: &DocPath) -> bool

If there is a values matcher defined at the path in this context

source

fn direct_matcher_defined( &self, path: &DocPath, matchers: &HashSet<&str> ) -> bool

If a matcher defined at the path (ignoring parents)

source

fn match_keys( &self, path: &DocPath, expected: &BTreeSet<String>, actual: &BTreeSet<String> ) -> Result<(), Vec<CommonMismatch>>

Matches the keys of the expected and actual maps

source

fn plugin_configuration(&self) -> &HashMap<String, PluginInteractionConfig>

Returns the plugin configuration associated with the context

source

fn matchers(&self) -> &MatchingRuleCategory

Returns the matching rules for the matching context

source

fn config(&self) -> DiffConfig

Configuration to apply when matching with the context

source

fn clone_with( &self, matchers: &MatchingRuleCategory ) -> Box<dyn MatchingContext + Send + Sync>

Clones the current context with the provided matching rules

Implementors§