Expand description
Implementations
sourceimpl<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
sourceimpl<I: Debug + Display + Hash, S: Span + Display + Debug> Error for Simple<I, S>
impl<I: Debug + Display + Hash, S: Span + Display + Debug> Error for Simple<I, S>
1.30.0 · sourcefn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
The lower-level source of this error, if any. Read more
sourcefn backtrace(&self) -> Option<&Backtrace>
fn backtrace(&self) -> Option<&Backtrace>
backtrace
)Returns a stack backtrace, if available, of where this error occurred. Read more
1.0.0 · sourcefn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
sourceimpl<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 Span = S
type Span = S
The type of spans to be used in the error.
type Label = &'static str
type Label = &'static str
The label used to describe a syntatic structure currently being parsed. Read more
sourcefn 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
sourcefn 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
sourcefn with_label(self, label: Self::Label) -> Self
fn with_label(self, label: Self::Label) -> Self
Indicate that the error occured while parsing a particular syntactic structure. Read more
Auto Trait Implementations
impl<I, S> RefUnwindSafe for Simple<I, S> where
I: RefUnwindSafe,
S: RefUnwindSafe,
impl<I, S> Send for Simple<I, S> where
I: Send,
S: Send,
impl<I, S> Sync for Simple<I, S> where
I: Sync,
S: Sync,
impl<I, S> Unpin for Simple<I, S> where
I: Unpin,
S: Unpin,
impl<I, S> UnwindSafe for Simple<I, S> where
I: UnwindSafe,
S: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more