Trait TrackResult

Source
pub trait TrackResult<C, I>{
    // Required methods
    fn track(self) -> Self;
    fn track_as(self, code: C) -> Self;
}
Expand description

This is an extension trait for nom-Results.

This is for inline tracking of parser results.

let (rest, h0) = nom_header(input).track_as(APCHeader)?;
let (rest, _) = nom_tag_plan(rest).track_as(APCPlan)?;
let (rest, plan) = token_name(rest).track()?;
let (rest, h1) = nom_header(rest).track_as(APCHeader)?;

Required Methods§

Source

fn track(self) -> Self

Track an Err() result.

Source

fn track_as(self, code: C) -> Self

Track an Err() result and modify the error code in one go.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<C, I, O, E> TrackResult<C, I> for Result<(I, O), Err<E>>
where C: Code, I: Clone + Debug + TrackedSpan<C> + InputTake + InputLength + InputIter + AsBytes, E: Debug, Err<E>: KParseError<C, I>,

Source§

fn track(self) -> Self

Tracks the result if it is an error.

Source§

fn track_as(self, code: C) -> Self

Changes the error code and tracks the result.

Implementors§