DiagnosticEmitter

Trait DiagnosticEmitter 

Source
pub trait DiagnosticEmitter {
    // Required method
    fn emit(&mut self, diagnostic: Diagnostic);
}
Expand description

Trait for receiving diagnostic messages

Implementations handle formatting and output of diagnostics. The solver and analyzer emit diagnostics through this trait, allowing different backends (CLI, LSP, tests) to handle them.

§Example

use utf8proj_core::{Diagnostic, DiagnosticEmitter};

struct CollectingEmitter {
    diagnostics: Vec<Diagnostic>,
}

impl DiagnosticEmitter for CollectingEmitter {
    fn emit(&mut self, diagnostic: Diagnostic) {
        self.diagnostics.push(diagnostic);
    }
}

Required Methods§

Source

fn emit(&mut self, diagnostic: Diagnostic)

Emit a diagnostic

Implementors§