Trait wagon_utils::ErrorReport
source · pub trait ErrorReport: Error {
// Required methods
fn span(self) -> Span;
fn msg(&self) -> (String, String);
// Provided methods
fn report(self) -> ((String, String), Span, Option<String>)
where Self: Sized { ... }
fn source(&self) -> Option<String> { ... }
}
Expand description
A trait for Error
s that return a specific message and span structure.
Required Methods§
Provided Methods§
sourcefn report(self) -> ((String, String), Span, Option<String>)where
Self: Sized,
fn report(self) -> ((String, String), Span, Option<String>)where
Self: Sized,
Return the full error report
sourcefn source(&self) -> Option<String>
fn source(&self) -> Option<String>
Return the text source for this error message.
Usually the source of the error is just the input file, in which case we return None
.
Sometimes, however, the source of the error may be a TokenStream
or some other text. In this case,
the output of source
should be that stream of text.