pub trait ToCliReport: Display {
// Required methods
fn location(&self) -> Option<SourceSpan>;
fn report(&self, report: &mut CliReport<'_>);
// Provided methods
fn to_report<'s>(
&self,
sources: &'s SourceMap,
color: Color,
) -> CliReport<'s> { ... }
fn to_diagnostic<'s>(
&'s self,
sources: &'s SourceMap,
) -> Diagnostic<'s, Self>
where Self: Sized { ... }
}
Expand description
Conversion to CliReport
Required Methods§
Sourcefn location(&self) -> Option<SourceSpan>
fn location(&self) -> Option<SourceSpan>
Return the main location for this error. May be None
if a location doesn’t make sense for
the particular error.
Sourcefn report(&self, report: &mut CliReport<'_>)
fn report(&self, report: &mut CliReport<'_>)
Fill in the report with source code labels.
The main message is already set to the output of fmt::Display
.
Provided Methods§
fn to_report<'s>(&self, sources: &'s SourceMap, color: Color) -> CliReport<'s>
Sourcefn to_diagnostic<'s>(&'s self, sources: &'s SourceMap) -> Diagnostic<'s, Self>where
Self: Sized,
fn to_diagnostic<'s>(&'s self, sources: &'s SourceMap) -> Diagnostic<'s, Self>where
Self: Sized,
Bundle this error together with a source map into a Diagnostic
The map normally comes from Schema::sources
or ExecutableDocument::sources
.