pub struct Trace {
pub events: Vec<TraceEvent>,
pub level: usize,
pub active: bool,
pub print: bool,
pub panic_on_level: Option<usize>,
}
Expand description
Represents a single trace in the parsing process.
A Trace
keeps track of parsing events, maintains the current nesting level,
and can be configured for various tracing behaviors.
Fields§
§events: Vec<TraceEvent>
The collection of trace events.
level: usize
The current nesting level of the trace.
active: bool
Whether the trace is currently active and recording events.
print: bool
Whether to print trace events in real-time.
panic_on_level: Option<usize>
The maximum nesting level before panicking, if set.
Implementations§
Source§impl Trace
impl Trace
Sourcepub fn open<I: AsRef<str>>(
&mut self,
context: Option<&'static str>,
input: I,
location: &'static str,
silent: bool,
) -> usize
pub fn open<I: AsRef<str>>( &mut self, context: Option<&'static str>, input: I, location: &'static str, silent: bool, ) -> usize
Records the opening of a parser in the trace.
§Arguments
context
- Optional context information for the event.input
- The input being parsed.location
- The location (usually function name) where this event occurred.silent
- Whether to suppress real-time printing of this event.
§Returns
The new nesting level after recording this event.
Sourcepub fn close<I: AsRef<str>, O: Debug, E: Debug>(
&mut self,
context: Option<&'static str>,
input: I,
location: &'static str,
result: &IResult<I, O, E>,
silent: bool,
) -> usize
pub fn close<I: AsRef<str>, O: Debug, E: Debug>( &mut self, context: Option<&'static str>, input: I, location: &'static str, result: &IResult<I, O, E>, silent: bool, ) -> usize
Records the closing of a parser in the trace.
§Arguments
context
- Optional context information for the event.input
- The input being parsed.location
- The location (usually function name) where this event occurred.result
- The result of the parsing operation.silent
- Whether to suppress real-time printing of this event.
§Returns
The new nesting level after recording this event.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Trace
impl RefUnwindSafe for Trace
impl Send for Trace
impl Sync for Trace
impl Unpin for Trace
impl UnwindSafe for Trace
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more