1 //! # Chapter 8: Debugging 2 //! 3 //! When things inevitably go wrong, you can introspect the parsing state by running your test case 4 //! with `--features debug`: 5 //!  6 //! 7 //! You can extend your own parsers to show up by wrapping their body with 8 //! [`trace`][crate::combinator::trace]. Going back to [`do_nothing_parser`][super::chapter_1]. 9 //! ```rust 10 //! # use winnow::PResult; 11 //! # use winnow::Parser; 12 //! use winnow::combinator::trace; 13 //! 14 //! pub fn do_nothing_parser<'s>(input: &mut &'s str) -> PResult<&'s str> { 15 //! trace( 16 //! "do_nothing_parser", 17 //! |i: &mut _| Ok("") 18 //! ).parse_next(input) 19 //! } 20 //! # 21 //! # fn main() { 22 //! # let mut input = "0x1a2b Hello"; 23 //! # 24 //! # let output = do_nothing_parser.parse_next(&mut input).unwrap(); 25 //! # // Same as: 26 //! # // let output = do_nothing_parser(&mut input).unwrap(); 27 //! # 28 //! # assert_eq!(input, "0x1a2b Hello"); 29 //! # assert_eq!(output, ""); 30 //! # } 31 //! ``` 32 33 pub use super::chapter_7 as previous; 34 pub use crate::_tutorial as table_of_contents; 35