pub struct RuleCore<L: Language> {
pub fixer: Option<Fixer<L>>,
/* private fields */
}Fields§
§fixer: Option<Fixer<L>>Implementations§
Source§impl<L: Language> RuleCore<L>
impl<L: Language> RuleCore<L>
pub fn new(rule: Rule<L>) -> Self
pub fn with_matchers(self, constraints: HashMap<String, Rule<L>>) -> Self
pub fn with_utils(self, utils: RuleRegistration<L>) -> Self
pub fn with_transform(self, transform: Option<Transform>) -> Self
pub fn with_fixer(self, fixer: Option<Fixer<L>>) -> Self
pub fn get_env(&self, lang: L) -> DeserializeEnv<L>
pub fn defined_vars(&self) -> HashSet<&str>
Methods from Deref<Target = Rule<L>>§
pub fn is_atomic(&self) -> bool
pub fn is_relational(&self) -> bool
pub fn is_composite(&self) -> bool
pub fn defined_vars(&self) -> HashSet<&str>
Sourcepub fn verify_util(&self) -> Result<(), RuleSerializeError>
pub fn verify_util(&self) -> Result<(), RuleSerializeError>
check if util rules used are defined
Trait Implementations§
Source§impl<L: Language> Matcher<L> for RuleCore<L>
impl<L: Language> Matcher<L> for RuleCore<L>
Source§fn match_node_with_env<'tree, D: Doc<Lang = L>>(
&self,
node: Node<'tree, D>,
env: &mut Cow<'_, MetaVarEnv<'tree, D>>,
) -> Option<Node<'tree, D>>
fn match_node_with_env<'tree, D: Doc<Lang = L>>( &self, node: Node<'tree, D>, env: &mut Cow<'_, MetaVarEnv<'tree, D>>, ) -> Option<Node<'tree, D>>
Returns the node why the input is matched or None if not matched.
The return value is usually input node itself, but it can be different node.
For example
Has matcher can return the child or descendant node.Source§fn potential_kinds(&self) -> Option<BitSet>
fn potential_kinds(&self) -> Option<BitSet>
Returns a bitset for all possible target node kind ids.
Returns None if the matcher needs to try against all node kind.
Source§fn get_match_len<D>(&self, _node: Node<'_, D>) -> Option<usize>where
D: Doc<Lang = L>,
fn get_match_len<D>(&self, _node: Node<'_, D>) -> Option<usize>where
D: Doc<Lang = L>,
get_match_len will skip trailing anonymous child node to exclude punctuation.
fn match_node<'tree, D>(
&self,
node: Node<'tree, D>,
) -> Option<NodeMatch<'tree, D>>where
D: Doc<Lang = L>,
fn find_node<'tree, D>(
&self,
node: Node<'tree, D>,
) -> Option<NodeMatch<'tree, D>>where
D: Doc<Lang = L>,
Auto Trait Implementations§
impl<L> Freeze for RuleCore<L>
impl<L> RefUnwindSafe for RuleCore<L>where
L: RefUnwindSafe,
impl<L> Send for RuleCore<L>
impl<L> Sync for RuleCore<L>
impl<L> Unpin for RuleCore<L>where
L: Unpin,
impl<L> UnwindSafe for RuleCore<L>where
L: UnwindSafe,
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