[][src]Enum combine::stream::easy::Error

pub enum Error<T, R> {
    Unexpected(Info<T, R>),
    Expected(Info<T, R>),
    Message(Info<T, R>),
    Other(Box<dyn 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<dyn StdError + Send + Sync>)

Variant for containing other types of errors

Implementations

impl<T, R> Error<T, R>[src]

pub fn map_token<F, U>(self, f: F) -> Error<U, R> where
    F: FnOnce(T) -> U, 
[src]

pub fn map_range<F, S>(self, f: F) -> Error<T, S> where
    F: FnOnce(R) -> S, 
[src]

impl<T, R> Error<T, R>[src]

pub fn end_of_input() -> Error<T, R>[src]

Returns the end_of_input error.

pub fn fmt_errors(errors: &[Error<T, R>], f: &mut Formatter<'_>) -> Result where
    T: Display,
    R: Display
[src]

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

impl<T: Debug, R: Debug> Debug for Error<T, R>[src]

impl<T: Display, R: Display> Display for Error<T, R>[src]

impl<T, R, E> From<E> for Error<T, R> where
    E: StdError + 'static + Send + Sync
[src]

impl<Item, Range, Position> ParseError<Item, Range, Position> for Error<Item, Range> where
    Item: PartialEq,
    Range: PartialEq,
    Position: Default
[src]

type StreamError = Self

impl<T: PartialEq, R: PartialEq> PartialEq<Error<T, R>> for Error<T, R>[src]

impl<Item, Range> StreamError<Item, Range> for Error<Item, Range> where
    Item: PartialEq,
    Range: PartialEq
[src]

Auto Trait Implementations

impl<T, R> !RefUnwindSafe for Error<T, R>

impl<T, R> Send for Error<T, R> where
    R: Send,
    T: Send

impl<T, R> Sync for Error<T, R> where
    R: Sync,
    T: Sync

impl<T, R> Unpin for Error<T, R> where
    R: Unpin,
    T: Unpin

impl<T, R> !UnwindSafe for Error<T, R>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<!> for T[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.