Sha256: efa2d44ec3d35316288e33a9f5003f03b979756ecae928a16ff9e71c84092a9a

Contents?: true

Size: 1.16 KB

Versions: 8

Compression:

Stored size: 1.16 KB

Contents

//! # Chapter 8: Debugging
//!
//! When things inevitably go wrong, you can introspect the parsing state by running your test case
//! with `--features winnow/debug`:
//!
//! ![Trace output from string example](https://raw.githubusercontent.com/winnow-rs/winnow/main/assets/trace.svg "Example output")
//!
//! You can extend your own parsers to show up by wrapping their body with
//! [`trace`][crate::combinator::trace].  Going back to [`do_nothing_parser`][super::chapter_1].
//! ```rust
//! # use winnow::PResult;
//! # use winnow::Parser;
//! use winnow::combinator::trace;
//!
//! pub fn do_nothing_parser<'s>(input: &mut &'s str) -> PResult<&'s str> {
//!     trace(
//!         "do_nothing_parser",
//!         |i: &mut _| Ok("")
//!     ).parse_next(input)
//! }
//! #
//! # fn main() {
//! #     let mut input = "0x1a2b Hello";
//! #
//! #     let output = do_nothing_parser.parse_next(&mut input).unwrap();
//! #     // Same as:
//! #     // let output = do_nothing_parser(&mut input).unwrap();
//! #
//! #     assert_eq!(input, "0x1a2b Hello");
//! #     assert_eq!(output, "");
//! # }
//! ```

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

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
wasmtime-29.0.0 ./ext/cargo-vendor/winnow-0.6.24/src/_tutorial/chapter_8.rs
wasmtime-28.0.0 ./ext/cargo-vendor/winnow-0.6.22/src/_tutorial/chapter_8.rs
wasmtime-27.0.0 ./ext/cargo-vendor/winnow-0.6.20/src/_tutorial/chapter_8.rs
wasmtime-26.0.0 ./ext/cargo-vendor/winnow-0.6.20/src/_tutorial/chapter_8.rs
wasmtime-25.0.2 ./ext/cargo-vendor/winnow-0.6.18/src/_tutorial/chapter_8.rs
wasmtime-25.0.1 ./ext/cargo-vendor/winnow-0.6.18/src/_tutorial/chapter_8.rs
wasmtime-25.0.0 ./ext/cargo-vendor/winnow-0.6.18/src/_tutorial/chapter_8.rs
wasmtime-24.0.0 ./ext/cargo-vendor/winnow-0.6.18/src/_tutorial/chapter_8.rs