pub struct Diagnostic {
pub severity: Severity,
pub code: DiagnosticCode,
pub message: String,
pub file: PathBuf,
pub line: usize,
pub span: Option<Span>,
pub suggestion: Option<String>,
pub verbosity: DiagnosticVerbosity,
}Expand description
A single located diagnostic.
Fields§
§severity: Severity§code: DiagnosticCode§message: String§file: PathBuf§line: usize1-based line number; 0 means “no specific line”.
span: Option<Span>§suggestion: Option<String>§verbosity: DiagnosticVerbosityVerbosity gating (T13.5), set per diagnostic at emission — see DiagnosticVerbosity.
Defaults to DiagnosticVerbosity::AlwaysOn; the few reference-zic -v-gated warnings (e.g.
the “fewer than 3 characters” abbreviation case) set DiagnosticVerbosity::VerboseOnly via
Diagnostic::verbose_only. (No filter is applied yet — zic-rs surfaces everything; the
default-vs-verbose split is T13.6. This field records the gating so it isn’t lost.)
Implementations§
Source§impl Diagnostic
impl Diagnostic
Sourcepub fn error(
code: DiagnosticCode,
message: impl Into<String>,
file: &Path,
line: usize,
) -> Self
pub fn error( code: DiagnosticCode, message: impl Into<String>, file: &Path, line: usize, ) -> Self
Construct an error-severity diagnostic.
Sourcepub fn warning(
code: DiagnosticCode,
message: impl Into<String>,
file: &Path,
line: usize,
) -> Self
pub fn warning( code: DiagnosticCode, message: impl Into<String>, file: &Path, line: usize, ) -> Self
Construct a warning-severity diagnostic.
Sourcepub fn with_suggestion(self, s: impl Into<String>) -> Self
pub fn with_suggestion(self, s: impl Into<String>) -> Self
Attach a suggestion (builder style).
Sourcepub fn verbose_only(self) -> Self
pub fn verbose_only(self) -> Self
Mark this diagnostic as verbose-only (T13.5) — surfaced only in a future -v/verbose mode,
mirroring reference zic’s noise-gated warnings (e.g. the “fewer than 3 characters”
abbreviation case). Builder style; default is DiagnosticVerbosity::AlwaysOn.
Trait Implementations§
Source§impl Clone for Diagnostic
impl Clone for Diagnostic
Source§fn clone(&self) -> Diagnostic
fn clone(&self) -> Diagnostic
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more