Expand description
Implementations§
source§impl<I: Hash + Eq, S: Clone> Simple<I, S>
impl<I: Hash + Eq, S: Clone> Simple<I, S>
sourcepub fn custom<M: ToString>(span: S, msg: M) -> Self
pub fn custom<M: ToString>(span: S, msg: M) -> Self
Create an error with a custom error message.
sourcepub fn expected(&self) -> impl ExactSizeIterator<Item = &Option<I>> + '_
pub fn expected(&self) -> impl ExactSizeIterator<Item = &Option<I>> + '_
Returns an iterator over possible expected patterns.
sourcepub fn found(&self) -> Option<&I>
pub fn found(&self) -> Option<&I>
Returns the input, if any, that was found instead of an expected pattern.
sourcepub fn reason(&self) -> &SimpleReason<I, S>
pub fn reason(&self) -> &SimpleReason<I, S>
Returns the reason for the error.
sourcepub fn map<U: Hash + Eq, F: FnMut(I) -> U>(self, f: F) -> Simple<U, S>
pub fn map<U: Hash + Eq, F: FnMut(I) -> U>(self, f: F) -> Simple<U, S>
Map the error’s inputs using the given function.
This can be used to unify the errors between parsing stages that operate upon two forms of input (for example, the initial lexing stage and the parsing stage in most compilers).
Trait Implementations§
source§impl<I: Hash + Eq, S: Span + Clone + Debug> Error<I> for Simple<I, S>
impl<I: Hash + Eq, S: Span + Clone + Debug> Error<I> for Simple<I, S>
§type Label = &'static str
type Label = &'static str
The label used to describe a syntactic structure currently being parsed. Read more
source§fn expected_input_found<Iter: IntoIterator<Item = Option<I>>>(
span: Self::Span,
expected: Iter,
found: Option<I>
) -> Self
fn expected_input_found<Iter: IntoIterator<Item = Option<I>>>(
span: Self::Span,
expected: Iter,
found: Option<I>
) -> Self
Create a new error describing a conflict between expected inputs and that which was actually found. Read more
source§fn unclosed_delimiter(
unclosed_span: Self::Span,
delimiter: I,
span: Self::Span,
expected: I,
found: Option<I>
) -> Self
fn unclosed_delimiter(
unclosed_span: Self::Span,
delimiter: I,
span: Self::Span,
expected: I,
found: Option<I>
) -> Self
Create a new error describing a delimiter that was not correctly closed. Read more
source§fn with_label(self, label: Self::Label) -> Self
fn with_label(self, label: Self::Label) -> Self
Indicate that the error occurred while parsing a particular syntactic structure. Read more
source§impl<I: Debug + Display + Hash + Eq, S: Span + Display + Debug> Error for Simple<I, S>
impl<I: Debug + Display + Hash + Eq, S: Span + Display + Debug> Error for Simple<I, S>
1.30.0 · source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
The lower-level source of this error, if any. Read more
1.0.0 · source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()