pub struct TraceList {
pub traces: HashMap<&'static str, Trace>,
}Expand description
A collection of traces, each associated with a tag.
The tag system allows for multiple independent traces to be maintained simultaneously.
Each tag corresponds to a separate Trace instance, allowing for organization and
separation of trace events based on different criteria (e.g., parser type, subsystem, etc.).
Fields§
§traces: HashMap<&'static str, Trace>Implementations§
source§impl TraceList
impl TraceList
sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new TraceList with a default trace.
The default trace is associated with the DEFAULT_TAG.
sourcepub fn reset(&mut self, tag: &'static str)
pub fn reset(&mut self, tag: &'static str)
Resets the trace for the given tag.
This clears all events and resets the nesting level for the specified trace. If the trace doesn’t exist, a new one is created and inserted.
sourcepub fn get_trace(&self, tag: &'static str) -> Option<String>
pub fn get_trace(&self, tag: &'static str) -> Option<String>
Returns the trace for the given tag as a string, if it exists.
sourcepub fn activate(&mut self, tag: &'static str)
pub fn activate(&mut self, tag: &'static str)
Activates the trace for the given tag.
Activated traces will record events. If the trace doesn’t exist, a new one is created and activated.
sourcepub fn deactivate(&mut self, tag: &'static str)
pub fn deactivate(&mut self, tag: &'static str)
Deactivates the trace for the given tag.
Deactivated traces will not record events, but will retain previously recorded events. If the trace doesn’t exist, a new one is created (but left inactive).
sourcepub fn open<I>(
&mut self,
tag: &'static str,
context: Option<&'static str>,
input: I,
location: &'static str,
)
pub fn open<I>( &mut self, tag: &'static str, context: Option<&'static str>, input: I, location: &'static str, )
Opens a new trace event for the given tag.
This increases the nesting level for the trace and records an ‘open’ event. The hierarchical structure of parsing is represented by these nested open/close events.
sourcepub fn close<I, O: Debug, E: Debug>(
&mut self,
tag: &'static str,
context: Option<&'static str>,
input: I,
location: &'static str,
result: &IResult<I, O, E>,
)
pub fn close<I, O: Debug, E: Debug>( &mut self, tag: &'static str, context: Option<&'static str>, input: I, location: &'static str, result: &IResult<I, O, E>, )
Closes the current trace event for the given tag.
This decreases the nesting level for the trace and records a ‘close’ event, including the result of the parsing operation (success, error, etc.). The hierarchical structure is maintained by matching each ‘close’ with a previous ‘open’.