Struct combine::stream::easy::Errors [−][src]
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<I, 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<I, R, P> Errors<I, R, P>
[src]
impl<I, R, P> Errors<I, R, P>
pub fn new(position: P, error: Error<I, R>) -> Errors<I, R, P>
[src]
pub fn new(position: P, error: Error<I, R>) -> Errors<I, R, P>
Constructs a new ParseError
which occurred at position
.
pub fn empty(position: P) -> Errors<I, R, P>
[src]
pub fn empty(position: P) -> Errors<I, R, P>
Constructs an error with no other information than the position it occurred at.
pub fn from_errors(position: P, errors: Vec<Error<I, R>>) -> Errors<I, R, P>
[src]
pub fn from_errors(position: P, errors: Vec<Error<I, R>>) -> Errors<I, R, P>
Constructs a ParseError
with multiple causes.
pub fn end_of_input(position: P) -> Errors<I, R, P>
[src]
pub fn end_of_input(position: P) -> Errors<I, R, P>
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<I, R>) where
I: PartialEq,
R: PartialEq,
[src]
pub fn add_error(&mut self, error: Error<I, R>) where
I: PartialEq,
R: PartialEq,
Adds an error if error
does not exist in this ParseError
already (as determined byte
PartialEq
).
pub fn set_expected(&mut self, info: Info<I, R>)
[src]
pub fn set_expected(&mut self, info: Info<I, R>)
Removes all Expected
errors in self
and adds info
instead.
pub fn merge(self, other: Errors<I, R, P>) -> Errors<I, R, P> where
P: Ord,
I: PartialEq,
R: PartialEq,
[src]
pub fn merge(self, other: Errors<I, R, P>) -> Errors<I, R, P> where
P: Ord,
I: PartialEq,
R: PartialEq,
Merges two ParseError
s. 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<I, R, Q> where
F: FnOnce(P) -> Q,
[src]
pub fn map_position<F, Q>(self, f: F) -> Errors<I, R, Q> where
F: FnOnce(P) -> Q,
Maps the position to a new value
pub fn map_token<F, U>(self, f: F) -> Errors<U, R, P> where
F: FnMut(I) -> U,
[src]
pub fn map_token<F, U>(self, f: F) -> Errors<U, R, P> where
F: FnMut(I) -> U,
Maps all token variants to a new value
pub fn map_range<F, S>(self, f: F) -> Errors<I, S, P> where
F: FnMut(R) -> S,
[src]
pub fn map_range<F, S>(self, f: F) -> Errors<I, S, P> where
F: FnMut(R) -> S,
Maps all range variants to a new value.
use combine::Parser; 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]
impl<Item, Range, Position> ParseError<Item, Range, Position> for Errors<Item, Range, Position> where
Item: PartialEq,
Range: PartialEq,
Position: Ord,
type StreamError = Error<Item, Range>
fn empty(pos: Position) -> Self
[src]
fn empty(pos: Position) -> Self
Constructs an empty error. Read more
fn from_error(position: Position, err: Self::StreamError) -> Self
[src]
fn from_error(position: 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 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(&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 clear_expected(&mut self)
[src]
fn clear_expected(&mut self)
Removes any expected errors currently in 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 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>)
impl<I: Debug, R: Debug, P: Debug> Debug for Errors<I, R, P>
[src]
impl<I: Debug, R: Debug, P: Debug> Debug for Errors<I, R, P>
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<I: PartialEq, R: PartialEq, P: PartialEq> PartialEq for Errors<I, R, P>
[src]
impl<I: PartialEq, R: PartialEq, P: PartialEq> PartialEq for Errors<I, R, P>
fn eq(&self, other: &Errors<I, R, P>) -> bool
[src]
fn eq(&self, other: &Errors<I, R, P>) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Errors<I, R, P>) -> bool
[src]
fn ne(&self, other: &Errors<I, R, P>) -> bool
This method tests for !=
.
impl<I, R, P> StdError for Errors<I, R, P> where
P: Display + Debug,
I: Display + Debug,
R: Display + Debug,
[src]
impl<I, R, P> StdError for Errors<I, R, P> where
P: Display + Debug,
I: Display + Debug,
R: Display + Debug,
fn description(&self) -> &str
[src]
fn description(&self) -> &str
This method is soft-deprecated. Read more
fn cause(&self) -> Option<&Error>
1.0.0[src]
fn cause(&self) -> Option<&Error>
The lower-level cause of this error, if any. Read more
impl<I, R, P> Display for Errors<I, R, P> where
P: Display,
I: Display,
R: Display,
[src]
impl<I, R, P> Display for Errors<I, R, P> where
P: Display,
I: Display,
R: Display,