pub struct MetaVarEnv<'tree, D: Doc> { /* 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<'t, D: Doc> MetaVarEnv<'t, D>
impl<'t, D: Doc> MetaVarEnv<'t, D>
pub fn new() -> Self
pub fn insert(&mut self, id: &str, ret: Node<'t, D>) -> Option<&mut Self>
pub fn insert_multi( &mut self, id: &str, ret: Vec<Node<'t, D>>, ) -> Option<&mut Self>
pub fn get_match(&self, var: &str) -> Option<&Node<'t, D>>
pub fn get_multiple_matches(&self, var: &str) -> Vec<Node<'t, D>>
pub fn add_label(&mut self, label: &str, node: Node<'t, D>)
pub fn get_labels(&self, label: &str) -> Option<&Vec<Node<'t, D>>>
pub fn get_matched_variables( &self, ) -> impl Iterator<Item = MetaVariable> + use<'_, 't, D>
pub fn match_constraints<M: Matcher>( &mut self, var_matchers: &HashMap<MetaVariableID, M>, ) -> bool
pub fn insert_transformation( &mut self, var: &MetaVariable, name: &str, slice: Underlying<D>, )
pub fn get_transformed(&self, var: &str) -> Option<&Underlying<D>>
pub fn get_var_bytes<'s>( &'s self, var: &MetaVariable, ) -> Option<&'s [<D::Source as Content>::Underlying]>
Trait Implementations§
Source§impl<'tree, D: Clone + Doc> Clone for MetaVarEnv<'tree, D>
impl<'tree, D: Clone + Doc> Clone for MetaVarEnv<'tree, D>
Source§fn clone(&self) -> MetaVarEnv<'tree, D>
fn clone(&self) -> MetaVarEnv<'tree, D>
Returns a duplicate 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 moreSource§impl<D: Doc> Default for MetaVarEnv<'_, D>
impl<D: Doc> Default for MetaVarEnv<'_, D>
Auto Trait Implementations§
impl<'tree, D> Freeze for MetaVarEnv<'tree, D>
impl<'tree, D> RefUnwindSafe for MetaVarEnv<'tree, D>where
<D as Doc>::Node<'tree>: RefUnwindSafe,
D: RefUnwindSafe,
<<D as Doc>::Source as Content>::Underlying: RefUnwindSafe,
impl<'tree, D> Send for MetaVarEnv<'tree, D>
impl<'tree, D> Sync for MetaVarEnv<'tree, D>
impl<'tree, D> Unpin for MetaVarEnv<'tree, D>
impl<'tree, D> UnwindSafe for MetaVarEnv<'tree, D>where
<D as Doc>::Node<'tree>: UnwindSafe,
D: RefUnwindSafe,
<<D as Doc>::Source as Content>::Underlying: 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