[][src]Trait pattern_compiler::PatternProvider

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;

    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; fn is_wildcard(&self, kind: Self::PatternNodeKind) -> bool { ... }
fn get_wildcard(&self) -> Self::PatternNodeKind { ... } }

Associated Types

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.

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

The type of pattern node.

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.

Loading content...

Associated Constants

Loading content...

Required methods

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

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.

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.

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

Every PatternNodeKey should belong to one and only one PatternNodeKind.

Loading content...

Provided methods

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

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

Loading content...

Implementors

impl PatternProvider for SimplePatternProvider[src]

type PatternNodeKey = NodeIndex

type PatternNodeKind = NodeKind

type CfgVariable = CfgVar

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

fn get_wildcard(&self) -> Self::PatternNodeKind[src]

Loading content...