pub struct Error {
pub spans: Vec<Range<usize>>,
pub kind: Box<dyn ErrorKind>,
}
Expand description
An error associated with regions of source code that can be highlighted.
Fields§
§spans: Vec<Range<usize>>
The regions of the source code that this error originated from.
kind: Box<dyn ErrorKind>
The kind of error that occurred.
Implementations§
Source§impl Error
impl Error
Sourcepub fn new(spans: Vec<Range<usize>>, kind: impl ErrorKind + 'static) -> Self
pub fn new(spans: Vec<Range<usize>>, kind: impl ErrorKind + 'static) -> Self
Creates a new error with the given spans and kind.
Sourcepub fn build_report<'a>(
&self,
src_id: &'a str,
) -> Report<'_, (&'a str, Range<usize>)>
pub fn build_report<'a>( &self, src_id: &'a str, ) -> Report<'_, (&'a str, Range<usize>)>
Build a report from this error kind.
Trait Implementations§
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