trace

Macro trace 

Source
macro_rules! trace {
    ($parser:expr $(,)?) => { ... };
    ($tag:ident, $parser:expr $(,)?) => { ... };
    ($context:expr, $parser:expr $(,)?) => { ... };
    ($tag:ident, $context:expr, $parser:expr $(,)?) => { ... };
    ($caller:expr, $tag:ident, $parser:expr $(,)?) => { ... };
    ($caller:expr, $context:expr, $parser:expr $(,)?) => { ... };
    ($caller:expr, $tag:ident, $context:expr, $parser:expr $(,)?) => { ... };
}
Expand description

Adds tracing to a parser.

This macro wraps a parser with tracing functionality. It can be used with different combinations of tags, contexts, and parsers.

ยงUsage

  • trace!(parser): Uses the default tag and no context.
  • trace!(tag, parser): Uses a custom tag and no context.
  • trace!("context", parser): Uses the default tag and a custom context.
  • trace!(tag, "context", parser): Uses a custom tag and a custom context.

When the trace feature is disabled, this macro becomes a no-op and simply returns the parser.