Struct peresil::Progress [] [src]

#[must_use]
pub struct Progress<P, T, E> {
    pub point: P,
    pub status: Status<T, E>,
}

Tracks where the parser currently is and if it is successful.

On success, some value has been parsed. On failure, nothing has been parsed and the value indicates the reason for the failure. The returned point indicates where to next start parsing, often unchanged on failure.

Fields

point: P

The current location.

status: Status<T, E>

If the point indicates the location of a successful or failed parse.

Methods

impl<P, T, E> Progress<P, T, E>
[src]

fn success(point: P, val: T) -> Progress<P, T, E>

fn failure(point: P, val: E) -> Progress<P, T, E>

fn map<F, T2>(self, f: F) -> Progress<P, T2, E> where F: FnOnce(T) -> T2

Convert the success value, if there is one.

fn map_err<F, E2>(self, f: F) -> Progress<P, T, E2> where F: FnOnce(E) -> E2

Convert the failure value, if there is one.

fn optional(self, reset_to: P) -> (P, Option<T>)

Returns the value on success, or rewinds the point and returns None on failure.

Trait Implementations

impl<P: PartialEq, T: PartialEq, E: PartialEq> PartialEq for Progress<P, T, E>
[src]

fn eq(&self, __arg_0: &Progress<P, T, E>) -> bool

This method tests for self and other values to be equal, and is used by ==. Read more

fn ne(&self, __arg_0: &Progress<P, T, E>) -> bool

This method tests for !=.

impl<P: Debug, T: Debug, E: Debug> Debug for Progress<P, T, E>
[src]

fn fmt(&self, __arg_0: &mut Formatter) -> Result

Formats the value using the given formatter.