pub struct Error {
pub kind: ErrorKind,
pub span: Span,
pub source: Option<String>,
}Expand description
Parser and compiler errors
Fields§
§kind: ErrorKind§span: Span§source: Option<String>Implementations§
Source§impl Error
impl Error
pub fn new(kind: ErrorKind, span: Span) -> Self
pub fn with_source(self, source: String) -> Self
pub fn unexpected_token(expected: &str, found: &str, span: Span) -> Self
pub fn unexpected_eof(span: Span) -> Self
pub fn unsupported_feature(feature: &str, phase: &str, span: Span) -> Self
pub fn type_error(expected: &str, found: &str, span: Span) -> Self
pub fn array_size_mismatch(declared: usize, provided: usize, span: Span) -> Self
pub fn array2d_size_mismatch( declared_rows: usize, declared_cols: usize, provided_rows: usize, provided_cols: usize, span: Span, ) -> Self
pub fn array3d_size_mismatch( declared_d1: usize, declared_d2: usize, declared_d3: usize, provided_d1: usize, provided_d2: usize, provided_d3: usize, span: Span, ) -> Self
pub fn array2d_value_count_mismatch( expected: usize, provided: usize, span: Span, ) -> Self
pub fn array3d_value_count_mismatch( expected: usize, provided: usize, span: Span, ) -> Self
pub fn array2d_invalid_context(span: Span) -> Self
pub fn array3d_invalid_context(span: Span) -> Self
pub fn array2d_values_must_be_literal(span: Span) -> Self
pub fn array3d_values_must_be_literal(span: Span) -> Self
pub fn message(msg: &str, span: Span) -> Self
pub fn with_workaround(self, workaround: &str) -> Self
Sourcepub fn source_line(&self) -> Option<(String, usize)>
pub fn source_line(&self) -> Option<(String, usize)>
Get the line of source code where the error occurred
Trait Implementations§
Source§impl Error for Error
impl Error for Error
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()
impl StructuralPartialEq for Error
Auto Trait Implementations§
impl Freeze for Error
impl RefUnwindSafe for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl UnwindSafe for Error
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