Trait PatternProvider

Source
pub trait PatternProvider: Debug {
    type PatternNodeKey: Copy + Hash + Debug + PartialEq + Eq;
    type PatternNodeKind: Copy + Hash + Debug + PartialEq + Eq;
    type CfgVariable: Copy + Hash + Debug + PartialEq + Eq;

    const WILDCARD: Self::PatternNodeKind;

    // Required methods
    fn get_root(
        &self,
    ) -> ExpandedClauseNodes<Self::CfgVariable, Self::PatternNodeKey>;
    fn kind_includes(
        &self,
        kind: Self::PatternNodeKind,
        key: Self::PatternNodeKey,
    ) -> bool;
    fn expand_clause_nodes(
        &mut self,
        clause_nodes: Vec<Self::PatternNodeKey>,
    ) -> ExpandedClauseNodes<Self::CfgVariable, Self::PatternNodeKey>;
    fn get_kind(&self, key: Self::PatternNodeKey) -> Self::PatternNodeKind;

    // Provided methods
    fn is_wildcard(&self, kind: Self::PatternNodeKind) -> bool { ... }
    fn get_wildcard(&self) -> Self::PatternNodeKind { ... }
}

Required Associated Constants§

Required Associated Types§

Source

type PatternNodeKey: Copy + Hash + Debug + PartialEq + Eq

A reference to a unique node in the pattern graph. Every PatternNodeKey should belong to ONE and ONLY one PatternNodeKind.

Source

type PatternNodeKind: Copy + Hash + Debug + PartialEq + Eq

The type of pattern node.

Source

type CfgVariable: Copy + Hash + Debug + PartialEq + Eq

A variable in the output CFG. The provider is responsible for creating these as specializations are performed by expand_clause_nodes.

Required Methods§

Source

fn get_root( &self, ) -> ExpandedClauseNodes<Self::CfgVariable, Self::PatternNodeKey>

Source

fn kind_includes( &self, kind: Self::PatternNodeKind, key: Self::PatternNodeKey, ) -> bool

Used to determine if the given key should be included in the specialization on kind.

When passed a wildcard as kind, we are specializing on the default matrix. It should match wildcards ONLY.

§Invariants
  • Every PatternNodeKey should match on one and ONLY one PatternNodeKind.
Source

fn expand_clause_nodes( &mut self, clause_nodes: Vec<Self::PatternNodeKey>, ) -> ExpandedClauseNodes<Self::CfgVariable, Self::PatternNodeKey>

After clauses have been selected for specialization, this will be called with the set of all nodes that should be specialized on.

Source

fn get_kind(&self, key: Self::PatternNodeKey) -> Self::PatternNodeKind

Every PatternNodeKey should belong to one and only one PatternNodeKind.

Provided Methods§

Source

fn is_wildcard(&self, kind: Self::PatternNodeKind) -> bool

Source

fn get_wildcard(&self) -> Self::PatternNodeKind

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§