Enum combine::easy::Error [−][src]
pub enum Error<T, R> { Unexpected(Info<T, R>), Expected(Info<T, R>), Message(Info<T, R>), Other(Box<StdError + Send + Sync>), }
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
Expected(Info<T, R>)
Error indicating that the parser expected something else
Message(Info<T, R>)
Generic message
Other(Box<StdError + Send + Sync>)
Variant for containing other types of errors
Methods
impl<T, R> Error<T, R>
[src]
impl<T, R> Error<T, R>
pub fn map_token<F, U>(self, f: F) -> Error<U, R> where
F: FnOnce(T) -> U,
[src]
pub fn map_token<F, U>(self, f: F) -> Error<U, R> where
F: FnOnce(T) -> U,
pub fn map_range<F, S>(self, f: F) -> Error<T, S> where
F: FnOnce(R) -> S,
[src]
pub fn map_range<F, S>(self, f: F) -> Error<T, S> where
F: FnOnce(R) -> S,
impl<T, R> Error<T, R>
[src]
impl<T, R> Error<T, R>
pub fn end_of_input() -> Error<T, R>
[src]
pub fn end_of_input() -> Error<T, R>
Returns the end_of_input
error.
pub fn fmt_errors(errors: &[Error<T, R>], f: &mut Formatter) -> Result where
T: Display,
R: Display,
[src]
pub fn fmt_errors(errors: &[Error<T, R>], f: &mut Formatter) -> Result where
T: Display,
R: Display,
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(State::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
impl<T: Debug, R: Debug> Debug for Error<T, R>
[src]
impl<T: Debug, R: Debug> Debug for Error<T, R>
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<Item, Range> StreamError<Item, Range> for Error<Item, Range> where
Item: PartialEq,
Range: PartialEq,
[src]
impl<Item, Range> StreamError<Item, Range> for Error<Item, Range> where
Item: PartialEq,
Range: PartialEq,
fn unexpected_token(token: Item) -> Self
[src]
fn unexpected_token(token: Item) -> Self
fn unexpected_range(token: Range) -> Self
[src]
fn unexpected_range(token: Range) -> Self
fn unexpected_message<T>(msg: T) -> Self where
T: Display,
[src]
fn unexpected_message<T>(msg: T) -> Self where
T: Display,
fn unexpected_static_message(msg: &'static str) -> Self
[src]
fn unexpected_static_message(msg: &'static str) -> Self
fn expected_token(token: Item) -> Self
[src]
fn expected_token(token: Item) -> Self
fn expected_range(token: Range) -> Self
[src]
fn expected_range(token: Range) -> Self
fn expected_message<T>(msg: T) -> Self where
T: Display,
[src]
fn expected_message<T>(msg: T) -> Self where
T: Display,
fn expected_static_message(msg: &'static str) -> Self
[src]
fn expected_static_message(msg: &'static str) -> Self
fn message_message<T>(msg: T) -> Self where
T: Display,
[src]
fn message_message<T>(msg: T) -> Self where
T: Display,
fn message_static_message(msg: &'static str) -> Self
[src]
fn message_static_message(msg: &'static str) -> Self
fn message_token(token: Item) -> Self
[src]
fn message_token(token: Item) -> Self
fn message_range(token: Range) -> Self
[src]
fn message_range(token: Range) -> Self
fn other<E>(err: E) -> Self where
E: StdError + Send + Sync + 'static,
[src]
fn other<E>(err: E) -> Self where
E: StdError + Send + Sync + 'static,
fn into_other<T>(self) -> T where
T: StreamError<Item, Range>,
[src]
fn into_other<T>(self) -> T where
T: StreamError<Item, Range>,
Converts self
into a different StreamError
type. Read more
fn unexpected(info: Info<Item, Range>) -> Self
[src]
fn unexpected(info: Info<Item, Range>) -> Self
fn expected(info: Info<Item, Range>) -> Self
[src]
fn expected(info: Info<Item, Range>) -> Self
fn message(info: Info<Item, Range>) -> Self
[src]
fn message(info: Info<Item, Range>) -> Self
fn end_of_input() -> Self
[src]
fn end_of_input() -> Self
impl<Item, Range, Position> ParseError<Item, Range, Position> for Error<Item, Range> where
Item: PartialEq,
Range: PartialEq,
Position: Default,
[src]
impl<Item, Range, Position> ParseError<Item, Range, Position> for Error<Item, Range> where
Item: PartialEq,
Range: PartialEq,
Position: Default,
type StreamError = Self
fn empty(_: Position) -> Self
[src]
fn empty(_: Position) -> Self
Constructs an empty error. Read more
fn from_error(_: Position, err: Self::StreamError) -> Self
[src]
fn from_error(_: Position, err: Self::StreamError) -> Self
Creates a ParseError
from a single Self::StreamError
fn set_position(&mut self, _position: Position)
[src]
fn set_position(&mut self, _position: Position)
Sets the position of this ParseError
fn add(&mut self, err: Self::StreamError)
[src]
fn add(&mut self, err: Self::StreamError)
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>),
[src]
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
fn is_unexpected_end_of_input(&self) -> bool
[src]
fn is_unexpected_end_of_input(&self) -> bool
fn into_other<T>(self) -> T where
T: ParseError<Item, Range, Position>,
[src]
fn into_other<T>(self) -> T where
T: ParseError<Item, Range, Position>,
Does a best-effort conversion of self
into another ParseError
fn merge(self, other: Self) -> Self
[src]
fn merge(self, other: Self) -> Self
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
fn add_expected(&mut self, info: Info<Item, Range>)
[src]
fn add_expected(&mut self, info: Info<Item, Range>)
fn add_unexpected(&mut self, info: Info<Item, Range>)
[src]
fn add_unexpected(&mut self, info: Info<Item, Range>)
fn add_message(&mut self, info: Info<Item, Range>)
[src]
fn add_message(&mut self, info: Info<Item, Range>)
fn clear_expected(&mut self)
[src]
fn clear_expected(&mut self)
Removes any expected errors currently in self
impl<T: PartialEq, R: PartialEq> PartialEq for Error<T, R>
[src]
impl<T: PartialEq, R: PartialEq> PartialEq for Error<T, R>
fn eq(&self, other: &Error<T, R>) -> bool
[src]
fn eq(&self, other: &Error<T, R>) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl<T, R, E> From<E> for Error<T, R> where
E: StdError + 'static + Send + Sync,
[src]
impl<T, R, E> From<E> for Error<T, R> where
E: StdError + 'static + Send + Sync,
impl<T: Display, R: Display> Display for Error<T, R>
[src]
impl<T: Display, R: Display> Display for Error<T, R>