[][src]Struct combine::stream::easy::Errors

pub struct Errors<Input, R, P> {
    pub position: P,
    pub errors: Vec<Error<Input, R>>,
}

Struct which hold information about an error that occurred at a specific position. Can hold multiple instances of Error if more that one error occurred in the same position.

Fields

position: P

The position where the error occurred

errors: Vec<Error<Input, 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<Input, R, P> Errors<Input, R, P>[src]

pub fn new(position: P, error: Error<Input, R>) -> Errors<Input, R, P>[src]

Constructs a new ParseError which occurred at position.

pub fn empty(position: P) -> Errors<Input, R, P>[src]

Constructs an error with no other information than the position it occurred at.

pub fn from_errors(
    position: P,
    errors: Vec<Error<Input, R>>
) -> Errors<Input, R, P>
[src]

Constructs a ParseError with multiple causes.

pub fn end_of_input(position: P) -> Errors<Input, R, P>[src]

Constructs an end of input error. Should be returned by parsers which encounter end of input unexpectedly.

pub fn add_error(&mut self, error: Error<Input, R>) where
    Input: PartialEq,
    R: PartialEq
[src]

Adds an error if error does not exist in this ParseError already (as determined byte PartialEq).

pub fn set_expected(&mut self, info: Info<Input, R>)[src]

Removes all Expected errors in self and adds info instead.

pub fn merge(self, other: Errors<Input, R, P>) -> Errors<Input, R, P> where
    P: Ord,
    Input: PartialEq,
    R: PartialEq
[src]

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.

pub fn map_position<F, Q>(self, f: F) -> Errors<Input, R, Q> where
    F: FnOnce(P) -> Q, 
[src]

Maps the position to a new value

pub fn map_token<F, U>(self, f: F) -> Errors<U, R, P> where
    F: FnMut(Input) -> U, 
[src]

Maps all token variants to a new value

pub fn map_range<F, S>(self, f: F) -> Errors<Input, S, P> where
    F: FnMut(R) -> S, 
[src]

Maps all range variants to a new value.

use combine::*;
use combine::parser::range::range;
println!(
    "{}",
    range(&"HTTP"[..])
        .easy_parse("HTT")
        .unwrap_err()
        .map_range(|bytes| format!("{:?}", bytes))
);

Trait Implementations

impl<Item, Range, Position> ParseError<Item, Range, Position> for Errors<Item, Range, Position> where
    Item: PartialEq,
    Range: PartialEq,
    Position: Ord
[src]

type StreamError = Error<Item, Range>

impl<Input: PartialEq, R: PartialEq, P: PartialEq> PartialEq<Errors<Input, R, P>> for Errors<Input, R, P>[src]

impl<Input, R, P> Display for Errors<Input, R, P> where
    P: Display,
    Input: Display,
    R: Display
[src]

impl<Input: Debug, R: Debug, P: Debug> Debug for Errors<Input, R, P>[src]

impl<Input, R, P> Error for Errors<Input, R, P> where
    P: Display + Debug,
    Input: Display + Debug,
    R: Display + Debug
[src]

Auto Trait Implementations

impl<Input, R, P> Send for Errors<Input, R, P> where
    Input: Send,
    P: Send,
    R: Send

impl<Input, R, P> Sync for Errors<Input, R, P> where
    Input: Sync,
    P: Sync,
    R: Sync

impl<Input, R, P> Unpin for Errors<Input, R, P> where
    Input: Unpin,
    P: Unpin,
    R: Unpin

impl<Input, R, P> !UnwindSafe for Errors<Input, R, P>

impl<Input, R, P> !RefUnwindSafe for Errors<Input, R, P>

Blanket Implementations

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

impl<T> From<T> for 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.

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

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

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