pub struct MatcherContext<'db> {
pub captures: OrderedHashMap<SmolStrId<'db>, Vec<CapturedValue<'db>>>,
pub placeholder_to_rep_id: OrderedHashMap<SmolStrId<'db>, RepetitionId>,
pub current_repetition_stack: Vec<RepetitionId>,
pub next_repetition_id: usize,
pub repetition_indices: OrderedHashMap<RepetitionId, usize>,
pub repetition_match_counts: OrderedHashMap<RepetitionId, usize>,
pub repetition_operators: OrderedHashMap<RepetitionId, MacroRepetitionOperator<'db>>,
}Expand description
Context used during macro pattern matching and expansion. Tracks captured values, active repetition scopes, and repetition ownership per placeholder.
Fields§
§captures: OrderedHashMap<SmolStrId<'db>, Vec<CapturedValue<'db>>>The captured values per macro parameter name. These are flat lists, even for repeated placeholders.
placeholder_to_rep_id: OrderedHashMap<SmolStrId<'db>, RepetitionId>Maps each placeholder to the RepetitionId of the repetition block
they are part of. This helps the expansion phase know which iterators to advance together.
current_repetition_stack: Vec<RepetitionId>Stack of currently active repetition blocks. Used to assign placeholders
to their correct RepetitionId while recursing into nested repetitions.
next_repetition_id: usizeCounter for generating unique RepetitionIds.
repetition_indices: OrderedHashMap<RepetitionId, usize>Tracks the current index for each active repetition during expansion.
repetition_match_counts: OrderedHashMap<RepetitionId, usize>Count how many times each repetition matched.
repetition_operators: OrderedHashMap<RepetitionId, MacroRepetitionOperator<'db>>Store the repetition operator for each repetition.
Trait Implementations§
Source§impl<'db> Clone for MatcherContext<'db>
impl<'db> Clone for MatcherContext<'db>
Source§fn clone(&self) -> MatcherContext<'db>
fn clone(&self) -> MatcherContext<'db>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<'db> Debug for MatcherContext<'db>
impl<'db> Debug for MatcherContext<'db>
Source§impl<'db> Default for MatcherContext<'db>
impl<'db> Default for MatcherContext<'db>
Source§fn default() -> MatcherContext<'db>
fn default() -> MatcherContext<'db>
Auto Trait Implementations§
impl<'db> Freeze for MatcherContext<'db>
impl<'db> RefUnwindSafe for MatcherContext<'db>
impl<'db> Send for MatcherContext<'db>
impl<'db> Sync for MatcherContext<'db>
impl<'db> Unpin for MatcherContext<'db>
impl<'db> UnwindSafe for MatcherContext<'db>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<'db, T> DebugDbUpcast<'db, T> for Twhere
T: ?Sized,
impl<'db, T> DebugDbUpcast<'db, T> for Twhere
T: ?Sized,
fn debug_db_upcast(&'db self) -> &'db T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more