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,
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,
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.