pub struct Track;
Expand description
Central struct for tracking.
-
Create a TrackProvider with
Track::new_tracker()
-
Create a matching span with
new_span()
. Switches between debug and release mode, and tracking is only active in debug mode. -
Create a SourceStr/SourceBytes for row/column information.
-
Call the actual tracking functions:
- Track.enter(), Track.ok(), Track.err(), …
Implementations§
source§impl Track
impl Track
sourcepub fn new_tracker<C, I>() -> StdTracker<C, I>where
C: Code,
I: Clone + Debug + AsBytes + InputTake + InputLength + InputIter,
pub fn new_tracker<C, I>() -> StdTracker<C, I>where C: Code, I: Clone + Debug + AsBytes + InputTake + InputLength + InputIter,
Provider/Container for tracking data.
sourcepub fn new_span<'s, C, I>(
provider: &'s impl TrackProvider<C, I>,
text: I
) -> LocatedSpan<I, DynTrackProvider<'s, C, I>>where
C: Code,
I: Clone + Debug + AsBytes + InputTake + InputLength + InputIter + 's,
pub fn new_span<'s, C, I>( provider: &'s impl TrackProvider<C, I>, text: I ) -> LocatedSpan<I, DynTrackProvider<'s, C, I>>where C: Code, I: Clone + Debug + AsBytes + InputTake + InputLength + InputIter + 's,
Create a tracking span for the given text and TrackProvider.
sourcepub fn source_str(text: &str) -> SourceStr<'_>
pub fn source_str(text: &str) -> SourceStr<'_>
Create a source text map for the given text.
sourcepub fn source_bytes(text: &[u8]) -> SourceBytes<'_>
pub fn source_bytes(text: &[u8]) -> SourceBytes<'_>
Create a source text map for the given text.
sourcepub fn ok<C, I, O, E>(
&self,
rest: I,
input: I,
value: O
) -> Result<(I, O), Err<E>>where
C: Code,
I: Clone + Debug + TrackedSpan<C> + InputTake + InputLength + InputIter,
E: KParseError<C, I> + Debug,
pub fn ok<C, I, O, E>( &self, rest: I, input: I, value: O ) -> Result<(I, O), Err<E>>where C: Code, I: Clone + Debug + TrackedSpan<C> + InputTake + InputLength + InputIter, E: KParseError<C, I> + Debug,
Creates an Ok() Result from the parameters and tracks the result.
sourcepub fn err<C, I, O, E>(
&self,
err: E
) -> Result<(I, O), Err<<E as ErrOrNomErr>::WrappedError>>where
C: Code,
I: Clone + Debug + TrackedSpan<C> + InputTake + InputLength + InputIter,
E: KParseError<C, I> + ErrOrNomErr + Debug,
pub fn err<C, I, O, E>( &self, err: E ) -> Result<(I, O), Err<<E as ErrOrNomErr>::WrappedError>>where C: Code, I: Clone + Debug + TrackedSpan<C> + InputTake + InputLength + InputIter, E: KParseError<C, I> + ErrOrNomErr + Debug,
Tracks the error and creates a Result.
sourcepub fn ok_section<C, I>(&self, rest: I, input: I)where
C: Code,
I: TrackedSpan<C>,
pub fn ok_section<C, I>(&self, rest: I, input: I)where C: Code, I: TrackedSpan<C>,
When multiple Context.enter() calls are used within one function (to denote some separation), this can be used to exit such a compartment with an ok track.
sourcepub fn err_section<C, I, E>(&self, err: &E)where
C: Code,
I: Clone + Debug + TrackedSpan<C> + InputTake + InputLength + InputIter,
E: KParseError<C, I> + Debug,
pub fn err_section<C, I, E>(&self, err: &E)where C: Code, I: Clone + Debug + TrackedSpan<C> + InputTake + InputLength + InputIter, E: KParseError<C, I> + Debug,
When multiple Context.enter() calls are used within one function (to denote some separation), this can be used to exit such a compartment with an ok track.
sourcepub fn enter<C, I>(&self, func: C, span: I)where
C: Code,
I: TrackedSpan<C>,
pub fn enter<C, I>(&self, func: C, span: I)where C: Code, I: TrackedSpan<C>,
Enter a parser function.
sourcepub fn debug<C, I>(&self, span: I, debug: String)where
C: Code,
I: TrackedSpan<C>,
pub fn debug<C, I>(&self, span: I, debug: String)where C: Code, I: TrackedSpan<C>,
Track some debug info.
sourcepub fn info<C, I>(&self, span: I, info: &'static str)where
C: Code,
I: TrackedSpan<C>,
pub fn info<C, I>(&self, span: I, info: &'static str)where C: Code, I: TrackedSpan<C>,
Track some other info.
sourcepub fn warn<C, I>(&self, span: I, warn: &'static str)where
C: Code,
I: TrackedSpan<C>,
pub fn warn<C, I>(&self, span: I, warn: &'static str)where C: Code, I: TrackedSpan<C>,
Track some warning.