Struct Track

Source
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

Source

pub fn new_tracker<C, I>() -> StdTracker<C, I>

Provider/Container for tracking data.

Source

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.

Source

pub fn source_str(text: &str) -> SourceStr<'_>

Create a source text map for the given text.

Source

pub fn source_bytes(text: &[u8]) -> SourceBytes<'_>

Create a source text map for the given text.

Source

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.

Source

pub fn err<C, I, O, E>( &self, err: E, ) -> Result<(I, O), Err<<E as ErrOrNomErr>::WrappedError>>

Tracks the error and creates a Result.

Source

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.

Source

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.

Source

pub fn enter<C, I>(&self, func: C, span: I)
where C: Code, I: TrackedSpan<C>,

Enter a parser function.

Source

pub fn debug<C, I>(&self, span: I, debug: String)
where C: Code, I: TrackedSpan<C>,

Track some debug info.

Source

pub fn info<C, I>(&self, span: I, info: &'static str)
where C: Code, I: TrackedSpan<C>,

Track some other info.

Source

pub fn warn<C, I>(&self, span: I, warn: &'static str)
where C: Code, I: TrackedSpan<C>,

Track some warning.

Auto Trait Implementations§

§

impl Freeze for Track

§

impl RefUnwindSafe for Track

§

impl Send for Track

§

impl Sync for Track

§

impl Unpin for Track

§

impl UnwindSafe for Track

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.