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]
impl<P, T, E> Progress<P, T, E>
pub fn success(point: P, val: T) -> Progress<P, T, E>
[src]
pub fn success(point: P, val: T) -> Progress<P, T, E>
pub fn failure(point: P, val: E) -> Progress<P, T, E>
[src]
pub fn failure(point: P, val: E) -> Progress<P, T, E>
pub fn map<F, T2>(self, f: F) -> Progress<P, T2, E> where
F: FnOnce(T) -> T2,
[src]
pub fn map<F, T2>(self, f: F) -> Progress<P, T2, E> where
F: FnOnce(T) -> T2,
Convert the success value, if there is one.
pub fn and_then<F, T2>(self, restore_to: P, f: F) -> Progress<P, T2, E> where
F: FnOnce(T) -> Result<T2, E>,
[src]
pub fn and_then<F, T2>(self, restore_to: P, f: F) -> Progress<P, T2, E> where
F: FnOnce(T) -> Result<T2, E>,
Convert the success value, if there is one, potentially converting into a failure.
pub fn map_err<F, E2>(self, f: F) -> Progress<P, T, E2> where
F: FnOnce(E) -> E2,
[src]
pub 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.
pub fn optional(self, reset_to: P) -> (P, Option<T>)
[src]
pub 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: Debug, T: Debug, E: Debug> Debug for Progress<P, T, E>
[src]
impl<P: Debug, T: Debug, E: Debug> Debug for Progress<P, T, E>
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl<P: Copy, T: Copy, E: Copy> Copy for Progress<P, T, E>
[src]
impl<P: Copy, T: Copy, E: Copy> Copy for Progress<P, T, E>
impl<P: Clone, T: Clone, E: Clone> Clone for Progress<P, T, E>
[src]
impl<P: Clone, T: Clone, E: Clone> Clone for Progress<P, T, E>
fn clone(&self) -> Progress<P, T, E>
[src]
fn clone(&self) -> Progress<P, T, E>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
1.0.0
[src]Performs copy-assignment from source
. Read more
impl<P: PartialEq, T: PartialEq, E: PartialEq> PartialEq for Progress<P, T, E>
[src]
impl<P: PartialEq, T: PartialEq, E: PartialEq> PartialEq for Progress<P, T, E>