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>
pub fn new_tracker<C, I>() -> StdTracker<C, I>
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>>
pub fn new_span<'s, C, I>( provider: &'s impl TrackProvider<C, I>, text: I, ) -> LocatedSpan<I, DynTrackProvider<'s, C, I>>
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.