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
sourceimpl<'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 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
Trait Implementations
sourceimpl<'tree, L: Language> Default for MetaVarEnv<'tree, L>
impl<'tree, L: Language> Default for MetaVarEnv<'tree, L>
sourceimpl<'tree, L: Language> From<MetaVarEnv<'tree, L>> for HashMap<String, String>
impl<'tree, L: Language> From<MetaVarEnv<'tree, L>> for HashMap<String, String>
sourcefn from(env: MetaVarEnv<'tree, L>) -> Self
fn from(env: MetaVarEnv<'tree, L>) -> Self
Converts to this type from the input type.
Auto Trait Implementations
impl<'tree, L> RefUnwindSafe for MetaVarEnv<'tree, L>where
L: RefUnwindSafe,
impl<'tree, L> !Send for MetaVarEnv<'tree, L>
impl<'tree, L> !Sync for MetaVarEnv<'tree, L>
impl<'tree, L> Unpin for MetaVarEnv<'tree, L>where
L: Unpin,
impl<'tree, L> UnwindSafe for MetaVarEnv<'tree, L>where
L: UnwindSafe + RefUnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more