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<'tree, D: Doc> MetaVarEnv<'tree, D>

source

pub fn new() -> Self

source

pub fn insert( &mut self, id: MetaVariableID, ret: Node<'tree, D> ) -> Option<&mut Self>

source

pub fn insert_multi( &mut self, id: MetaVariableID, ret: Vec<Node<'tree, D>> ) -> Option<&mut Self>

source

pub fn insert_transformation( &mut self, name: MetaVariableID, src: Vec<<<D as Doc>::Source as Content>::Underlying> )

source

pub fn get_match(&self, var: &str) -> Option<&Node<'tree, D>>

source

pub fn get_multiple_matches(&self, var: &str) -> Vec<Node<'tree, D>>

source

pub fn get_transformed( &self, var: &str ) -> Option<&Vec<<<D as Doc>::Source as Content>::Underlying>>

source

pub fn get_var_bytes<'s>( &'s self, var: &MetaVariable ) -> Option<&'s [<D::Source as Content>::Underlying]>

source

pub fn add_label(&mut self, label: &str, node: Node<'tree, D>)

source

pub fn get_labels(&self, label: &str) -> Option<&Vec<Node<'tree, D>>>

source

pub fn get_matched_variables(&self) -> impl Iterator<Item = MetaVariable> + '_

source

pub fn match_constraints( &self, var_matchers: &MetaVarMatchers<impl Doc<Lang = D::Lang>> ) -> bool

Trait Implementations§

source§

impl<'tree, D: Clone + Doc> Clone for MetaVarEnv<'tree, D>

source§

fn clone(&self) -> MetaVarEnv<'tree, D>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<'tree, D: Doc> Default for MetaVarEnv<'tree, D>

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl<'tree, L: Language> From<MetaVarEnv<'tree, StrDoc<L>>> for HashMap<String, String>

source§

fn from(env: MetaVarEnv<'tree, StrDoc<L>>) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<'tree, D> RefUnwindSafe for MetaVarEnv<'tree, D>where 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>where <<D as Doc>::Source as Content>::Underlying: Unpin,

§

impl<'tree, D> UnwindSafe for MetaVarEnv<'tree, D>where D: RefUnwindSafe, <<D as Doc>::Source as Content>::Underlying: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.