Struct prqlc_parser::err::parse_error::ChumError
source · pub struct ChumError<T: Hash + Eq> { /* private fields */ }
Implementations§
source§impl<T: Hash + Eq> ChumError<T>
impl<T: Hash + Eq> ChumError<T>
sourcepub fn custom<M: ToString>(span: Span, msg: M) -> Self
pub fn custom<M: ToString>(span: Span, msg: M) -> Self
Create an error with a custom error message.
sourcepub fn expected(&self) -> impl ExactSizeIterator<Item = &Option<T>> + '_
pub fn expected(&self) -> impl ExactSizeIterator<Item = &Option<T>> + '_
Returns an iterator over possible expected patterns.
sourcepub fn found(&self) -> Option<&T>
pub fn found(&self) -> Option<&T>
Returns the input, if any, that was found instead of an expected pattern.
sourcepub fn map<U: Hash + Eq, F: FnMut(T) -> U>(self, f: F) -> ChumError<U>
pub fn map<U: Hash + Eq, F: FnMut(T) -> U>(self, f: F) -> ChumError<U>
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<T: Hash + Eq + Display + Debug> Error<T> for ChumError<T>
impl<T: Hash + Eq + Display + Debug> Error<T> for ChumError<T>
§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<T>>>(
span: Span,
expected: Iter,
found: Option<T>,
) -> Self
fn expected_input_found<Iter: IntoIterator<Item = Option<T>>>( span: Span, expected: Iter, found: Option<T>, ) -> 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: T,
span: Self::Span,
expected: T,
found: Option<T>,
) -> Self
fn unclosed_delimiter( unclosed_span: Self::Span, delimiter: T, span: Self::Span, expected: T, found: Option<T>, ) -> 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<T: Hash + Eq> PartialEq for ChumError<T>
impl<T: Hash + Eq> PartialEq for ChumError<T>
impl<T: Hash + Eq> Eq for ChumError<T>
Auto Trait Implementations§
impl<T> Freeze for ChumError<T>where
T: Freeze,
impl<T> RefUnwindSafe for ChumError<T>where
T: RefUnwindSafe,
impl<T> Send for ChumError<T>where
T: Send,
impl<T> Sync for ChumError<T>where
T: Sync,
impl<T> Unpin for ChumError<T>where
T: Unpin,
impl<T> UnwindSafe for ChumError<T>where
T: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more