Struct ast_grep_core::meta_var::MetaVarEnv
source · pub struct MetaVarEnv<'tree, L: Language> { /* private fields */ }
Expand description
a dictionary that stores metavariable instantiation const a = 123 matched with const a = $A will produce env: $A => 123
Implementations§
source§impl<'tree, L: Language> MetaVarEnv<'tree, L>
impl<'tree, L: Language> MetaVarEnv<'tree, L>
pub fn new() -> Self
pub fn from_matchers(var_matchers: MetaVarMatchers<L>) -> Self
pub fn insert(
&mut self,
id: MetaVariableID,
ret: Node<'tree, L>
) -> Option<&mut Self>
pub fn insert_multi(
&mut self,
id: MetaVariableID,
ret: Vec<Node<'tree, L>>
) -> Option<&mut Self>
pub fn get(&self, var: &MetaVariable) -> Option<MatchResult<'_, 'tree, L>>
pub fn get_match(&self, var: &str) -> Option<&Node<'tree, L>>
pub fn get_multiple_matches(&self, var: &str) -> Vec<Node<'tree, L>> ⓘ
pub fn add_label(&mut self, label: &str, node: Node<'tree, L>)
pub fn get_labels(&self, label: &str) -> Option<&Vec<Node<'tree, L>>>
pub fn match_constraints(&self) -> bool
pub fn get_matched_variables(&self) -> impl Iterator<Item = MetaVariable> + '_
Trait Implementations§
source§impl<'tree, L: Clone + Language> Clone for MetaVarEnv<'tree, L>
impl<'tree, L: Clone + Language> Clone for MetaVarEnv<'tree, L>
source§fn clone(&self) -> MetaVarEnv<'tree, L>
fn clone(&self) -> MetaVarEnv<'tree, L>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read more