Skip to content

How about a "trace" macro ? #630

@wakuflair

Description

@wakuflair

Please complete the following tasks

winnow version

0.6.20

Describe your use case

I found myself always need to surround my parser in trace function, so why don't we add a "trace" macro to make us more lazy?

Describe the solution you'd like

Something like:

#[trace]
fn my_parser(input: I) -> PResult<O> {
  ...
}

will be expanded to:

fn my_parser(input: I) -> PResult<O> {
  trace("my_parser", move |input: &mut _| {
   ...
  }).parse_next(input)
}

Alternatives, if applicable

No response

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-combinatorArea: combinatorsC-enhancementCategory: Raise on the bar on expectations

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions