error_engine/diagnostic.rs
1use std::fmt;
2
3#[derive(Debug, Clone, Copy, PartialEq, Eq)]
4pub enum Severity {
5 Error,
6 Warning,
7 Info,
8}
9
10/// Every "diagnosable" error/warning/info in the project implements this.
11/// `code()` is the key looked up in the project's TOML catalog.
12pub trait EngineDiagnostic: fmt::Debug {
13 fn code(&self) -> &'static str;
14 fn severity(&self) -> Severity;
15
16 /// Dynamic values to interpolate into the catalog template,
17 /// e.g. [("path", "/etc/config.toml")]
18 fn context(&self) -> Vec<(&'static str, String)> {
19 Vec::new()
20 }
21}