ToCliReport

Trait ToCliReport 

Source
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§

Source

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.

Source

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§

Source

fn to_report<'s>(&self, sources: &'s SourceMap, color: Color) -> CliReport<'s>

Source

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.

Implementations on Foreign Types§

Source§

impl<T: ToCliReport> ToCliReport for &T

Source§

fn location(&self) -> Option<SourceSpan>

Source§

fn report(&self, report: &mut CliReport<'_>)

Implementors§