pub struct Errors<T, R, P> {
    pub position: P,
    pub errors: Vec<Error<T, R>>,
}
Expand description

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<T, 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.

Implementations

Constructs a new ParseError which occurred at position.

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

Constructs a ParseError with multiple causes.

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

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

Removes all Expected errors in self and adds info instead.

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.

Maps the position to a new value

Maps all token variants to a new value

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

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

👎 Deprecated since 1.42.0:

use the Display impl or to_string()

The lower-level source of this error, if any. Read more

🔬 This is a nightly-only experimental API. (backtrace)

Returns a stack backtrace, if available, of where this error occurred. Read more

👎 Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Converts to this type from the input type.

Constructs an empty error. Read more

Creates a ParseError from a single Self::StreamError

Sets the position of this 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

Adds a StreamError to self. Read more

Sets info as the only Expected error of self

Removes any expected errors currently in self

Does a best-effort conversion of self into another ParseError

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

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.