Enum combine::easy::Error [−][src]
pub enum Error<T, R> {
Unexpected(Info<T, R>),
Expected(Info<T, R>),
Message(Info<T, R>),
Other(Box<dyn StdError + Send + Sync>),
}std only.Expand description
Enum used to store information about an error that has occurred during parsing.
Variants
Unexpected(Info<T, R>)Error indicating an unexpected token has been encountered in the stream
Tuple Fields of Unexpected
0: Info<T, R>Expected(Info<T, R>)Error indicating that the parser expected something else
Tuple Fields of Expected
0: Info<T, R>Message(Info<T, R>)Generic message
Tuple Fields of Message
0: Info<T, R>Variant for containing other types of errors
Implementations
Returns the end_of_input error.
Formats a slice of errors in a human readable way.
let input = r"
,123
";
let result = spaces().silent().with(char('.').or(char('a')).or(digit()))
.easy_parse(position::Stream::new(input));
let m = format!("{}", result.unwrap_err());
let expected = r"Parse error at line: 2, column: 3
Unexpected `,`
Expected `.`, `a` or `digit`
";
assert_eq!(m, expected);Trait Implementations
type StreamError = Self
Creates a ParseError from a single Self::StreamError
Sets the position of this ParseError
Adds a StreamError to self. Read more
fn set_expected<F>(self_: &mut Tracked<Self>, info: Self::StreamError, f: F) where
F: FnOnce(&mut Tracked<Self>),
fn set_expected<F>(self_: &mut Tracked<Self>, info: Self::StreamError, f: F) where
F: FnOnce(&mut Tracked<Self>),
Sets info as the only Expected error of self
Does a best-effort conversion of self into another ParseError
Merges two errors. If they exist at the same position the errors of other are
added to self (using the semantics of add). If they are not at the same
position the error furthest ahead are returned, ignoring the other ParseError. Read more
Removes any expected errors currently in self
impl<Item, Range> StreamError<Item, Range> for Error<Item, Range> where
Item: PartialEq,
Range: PartialEq,
impl<Item, Range> StreamError<Item, Range> for Error<Item, Range> where
Item: PartialEq,
Range: PartialEq,
Converts self into a different StreamError type. Read more