pub struct RantlrError {
pub kind: ErrorKind,
pub message: String,
pub line: usize,
pub column: usize,
pub snippet: String,
pub help: Option<String>,
pub code: Option<String>,
pub fix_hint: Option<FixHint>,
}Expand description
User-facing error for lex / parse / lint failures.
Fields§
§kind: ErrorKind§message: String§line: usize§column: usize§snippet: String§help: Option<String>§code: Option<String>§fix_hint: Option<FixHint>Implementations§
Source§impl RantlrError
impl RantlrError
pub fn from_diagnostic(source: &str, diag: Diagnostic) -> Self
pub fn parse(source: &str, message: impl Into<String>, span: Span) -> Self
pub fn parse_with_help( source: &str, message: impl Into<String>, span: Span, help: impl Into<String>, ) -> Self
pub fn format(&self, file: &str) -> String
Trait Implementations§
Source§impl Clone for RantlrError
impl Clone for RantlrError
Source§fn clone(&self) -> RantlrError
fn clone(&self) -> RantlrError
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for RantlrError
impl Debug for RantlrError
Source§impl Display for RantlrError
impl Display for RantlrError
impl Eq for RantlrError
Source§impl Error for RantlrError
impl Error for RantlrError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns 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()
Source§impl PartialEq for RantlrError
impl PartialEq for RantlrError
impl StructuralPartialEq for RantlrError
Auto Trait Implementations§
impl Freeze for RantlrError
impl RefUnwindSafe for RantlrError
impl Send for RantlrError
impl Sync for RantlrError
impl Unpin for RantlrError
impl UnsafeUnpin for RantlrError
impl UnwindSafe for RantlrError
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