pub(super) trait Tracker<'matcher> {
type Failure;
// Required methods
fn build_failure(
tok: Token,
position: u32,
msg: &'static str,
) -> Self::Failure;
fn description() -> &'static str;
// Provided methods
fn before_match_loc(
&mut self,
_parser: &TtParser,
_matcher: &'matcher MatcherLoc,
) { ... }
fn after_arm(
&mut self,
_result: &ParseResult<FxHashMap<MacroRulesNormalizedIdent, NamedMatch>, Self::Failure>,
) { ... }
fn recovery() -> Recovery { ... }
fn set_expected_token(&mut self, _tok: &'matcher Token) { ... }
fn get_expected_token(&self) -> Option<&'matcher Token> { ... }
}
Required Associated Types§
Required Methods§
Sourcefn build_failure(tok: Token, position: u32, msg: &'static str) -> Self::Failure
fn build_failure(tok: Token, position: u32, msg: &'static str) -> Self::Failure
Arm failed to match. If the token is token::Eof
, it indicates an unexpected
end of macro invocation. Otherwise, it indicates that no rules expected the given token.
The usize is the approximate position of the token in the input token stream.
Sourcefn description() -> &'static str
fn description() -> &'static str
For tracing.
Provided Methods§
Sourcefn before_match_loc(
&mut self,
_parser: &TtParser,
_matcher: &'matcher MatcherLoc,
)
fn before_match_loc( &mut self, _parser: &TtParser, _matcher: &'matcher MatcherLoc, )
This is called before trying to match next MatcherLoc on the current token.
Sourcefn after_arm(
&mut self,
_result: &ParseResult<FxHashMap<MacroRulesNormalizedIdent, NamedMatch>, Self::Failure>,
)
fn after_arm( &mut self, _result: &ParseResult<FxHashMap<MacroRulesNormalizedIdent, NamedMatch>, Self::Failure>, )
This is called after an arm has been parsed, either successfully or unsuccessfully. When
this is called, before_match_loc
was called at least once (with a MatcherLoc::Eof
).
fn recovery() -> Recovery
fn set_expected_token(&mut self, _tok: &'matcher Token)
fn get_expected_token(&self) -> Option<&'matcher Token>
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.