Struct combine::primitives::ParseError
[−]
[src]
pub struct ParseError<P, I, R> {
pub position: P,
pub errors: Vec<Error<I, R>>,
}Struct which hold information about an error that occured at a specific position.
Can hold multiple instances of Error if more that one error occured in the same position.
Fields
position: P
The position where the error occurred
errors: Vec<Error<I, R>>
A vector containing specific information on what errors occurred at position. Usually
a fully formed message contains one Unexpected error and one or more Expected errors.
Message and Other may also appear (combine never generates these errors on its own)
and may warrant custom handling.
Methods
impl<P, I, R> ParseError<P, I, R>[src]
fn new(position: P, error: Error<I, R>) -> ParseError<P, I, R>
Constructs a new ParseError which occurred at position.
fn empty(position: P) -> ParseError<P, I, R>
Constructs an error with no other information than the position it occurred at.
fn from_errors(position: P, errors: Vec<Error<I, R>>) -> ParseError<P, I, R>
Constructs a ParseError with multiple causes.
fn end_of_input(position: P) -> ParseError<P, I, R>
Constructs an end of input error. Should be returned by parsers which encounter end of input unexpectedly.
fn add_error(&mut self, error: Error<I, R>) where
I: PartialEq,
R: PartialEq,
I: PartialEq,
R: PartialEq,
Adds an error if error does not exist in this ParseError already (as determined byte
PartialEq).
fn set_expected(&mut self, info: Info<I, R>)
Remvoes all Expected errors in self and adds info instead.
fn merge(self, other: ParseError<P, I, R>) -> ParseError<P, I, R> where
P: Ord,
I: PartialEq,
R: PartialEq,
P: Ord,
I: PartialEq,
R: PartialEq,
Merges two ParseErrors. If they exist at the same position the errors of other are
added to self (using add_error to skip duplicates). If they are not at the same
position the error furthest ahead are returned, ignoring the other ParseError.
fn map_position<F, Q>(self, f: F) -> ParseError<Q, I, R> where
F: FnOnce(P) -> Q,
F: FnOnce(P) -> Q,
Maps the position to a new value
fn map_token<F, U>(self, f: F) -> ParseError<P, U, R> where
F: FnMut(I) -> U,
F: FnMut(I) -> U,
Maps all token variants to a new value
fn map_range<F, S>(self, f: F) -> ParseError<P, I, S> where
F: FnMut(R) -> S,
F: FnMut(R) -> S,
Maps all range variants to a new value.
use combine::Parser; use combine::range::range; println!( "{}", range(&"HTTP"[..]) .parse("HTT") .unwrap_err() .map_range(|bytes| format!("{:?}", bytes)) );
Trait Implementations
impl<P: Debug, I: Debug, R: Debug> Debug for ParseError<P, I, R>[src]
impl<P: PartialEq, I: PartialEq, R: PartialEq> PartialEq for ParseError<P, I, R>[src]
fn eq(&self, __arg_0: &ParseError<P, I, R>) -> bool
This method tests for self and other values to be equal, and is used by ==. Read more
fn ne(&self, __arg_0: &ParseError<P, I, R>) -> bool
This method tests for !=.
impl<P, I, R> StdError for ParseError<P, I, R> where
P: Display + Debug + Any,
I: Display + Debug + Any,
R: Display + Debug + Any, [src]
P: Display + Debug + Any,
I: Display + Debug + Any,
R: Display + Debug + Any,
fn description(&self) -> &str
A short description of the error. Read more
fn cause(&self) -> Option<&Error>1.0.0
The lower-level cause of this error, if any. Read more
impl<P, I, R> Display for ParseError<P, I, R> where
P: Display,
I: Display,
R: Display, [src]
P: Display,
I: Display,
R: Display,