Trait kparse::TrackResult

source ·
pub trait TrackResult<C, I>where
    C: Code,
    I: Clone + Debug + TrackedSpan<C> + InputTake + InputLength + InputIter + AsBytes,{
    // 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.

Object Safety§

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§