Enum pest::Error [] [src]

pub enum Error<R, I: Input> {
    ParsingError {
        positives: Vec<R>,
        negatives: Vec<R>,
        pos: Position<I>,
    },
    CustomErrorPos {
        message: String,
        pos: Position<I>,
    },
    CustomErrorSpan {
        message: String,
        span: Span<I>,
    },
}

An enum which defines possible errors.

Variants

Generated parsing error with expected and unexpected Rules and a position

Fields of ParsingError

Positive attempts

Negative attempts

Deepest position of attempts

Custom error with a message and a position

Fields of CustomErrorPos

Short explanation

Error Position for formatting

Custom error with a message and a span defined by a start and end position

Fields of CustomErrorSpan

Short explanation

Error Span for formatting

Methods

impl<R: RuleType, I: Input> Error<R, I>
[src]

Renames all Rules from a ParsingError variant returning a CustomErrorPos. It does nothing when called on CustomErrorPos and CustomErrorSpan variants.

Useful in order to rename verbose rules or have detailed per-Rule formatting.

Examples

Error::ParsingError {
    positives: vec![Rule::open_paren],
    negatives: vec![Rule::closed_paren],
    pos: pos
}.renamed_rules(|rule| {
    match *rule {
        Rule::open_paren => "(".to_owned(),
        Rule::closed_paren => "closed paren".to_owned()
    }
});

Trait Implementations

impl<R: Debug, I: Debug + Input> Debug for Error<R, I>
[src]

Formats the value using the given formatter.

impl<R: Debug, I: Input> Display for Error<R, I>
[src]

Formats the value using the given formatter. Read more

impl<R: Clone, I: Input> Clone for Error<R, I>
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

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

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl<R: Eq, I: Input> Eq for Error<R, I>
[src]

impl<R: Hash, I: Input> Hash for Error<R, I>
[src]

Feeds this value into the given [Hasher]. Read more

Feeds a slice of this type into the given [Hasher]. Read more