MetaVarEnv

Struct MetaVarEnv 

Source
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>

Source

pub fn new() -> Self

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

pub fn match_constraints<M: Matcher>( &mut self, var_matchers: &HashMap<MetaVariableID, M>, ) -> bool

Source

pub fn insert_transformation( &mut self, var: &MetaVariable, name: &str, slice: Underlying<D>, )

Source

pub fn get_transformed(&self, var: &str) -> Option<&Underlying<D>>

Source

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>

Source§

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)

Performs copy-assignment from source. Read more
Source§

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

Source§

fn default() -> Self

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

impl<'tree, D: Doc> From<MetaVarEnv<'tree, D>> for HashMap<String, String>

Source§

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

Converts to this type from the input type.

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>
where <D as Doc>::Node<'tree>: Send, D: Sync, <<D as Doc>::Source as Content>::Underlying: Send,

§

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

§

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

§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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 T
where 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 T
where T: Clone,

Source§

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 T
where U: Into<T>,

Source§

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 T
where U: TryFrom<T>,

Source§

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.