Skip to main content

Module chapter_8

Module chapter_8 

Source
Available on crate feature unstable-doc only.
Expand description

§Chapter 8: Debugging

When things inevitably go wrong, you can introspect the parsing state by running your test case with --features winnow/debug.

For example, the trace output of an escaped string parser: Trace output from string example

You can extend your own parsers to show up by wrapping their body with trace. Going back to do_nothing_parser.

use winnow::combinator::trace;

pub fn do_nothing_parser<'s>(input: &mut &'s str) -> ModalResult<&'s str> {
    trace(
        "do_nothing_parser",
        |i: &mut _| Ok("")
    ).parse_next(input)
}

Re-exports§

pub use super::chapter_7 as previous;
pub use crate::_topic as next;
pub use crate::_tutorial as table_of_contents;