pub struct ParserError {
pub kind: ParserErrorKind,
pub location: Fragment,
pub help: Vec<Cow<'static, str>>,
}Available on crate feature
parser only.Expand description
An error that occurred while parsing. This error structure is pretty simple compared to what can be represented using a diagnostic. That’s fine, since most of the more complex errors arise when typechecking, rather than checking syntax.
Fields§
§kind: ParserErrorKindWhat type/cause there is for this error.
location: FragmentWhere this error occurred.
help: Vec<Cow<'static, str>>Optional help strings that can be printed with this error.
Implementations§
Source§impl ParserError
impl ParserError
Sourcepub fn with_help(self, help: impl Into<Cow<'static, str>>) -> Self
pub fn with_help(self, help: impl Into<Cow<'static, str>>) -> Self
Builder-style method to add a help string to a ParserError.
Sourcepub fn as_diagnostic(self) -> Diagnostic
pub fn as_diagnostic(self) -> Diagnostic
Turn this parser error into a full blown compiler error.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ParserError
impl RefUnwindSafe for ParserError
impl Send for ParserError
impl Sync for ParserError
impl Unpin for ParserError
impl UnwindSafe for ParserError
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<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