Expand description
The diagnostic vocabulary shared by every PowerIO crate.
A free-form Vec<String> warning is useful for a human and opaque to CI, an
agent, or a downstream solver. Every finding a reader, a lowering pass, or a
writer records carries a stable DiagnosticCode, a DiagnosticSeverity,
a human message, and where known an element path, a SourceRef, a details
object, and a suggested action. The structured record is primary and the
text lines are rendered from it by render_line, so the two cannot
disagree.
A code reads NAMESPACE.SCOPE.SPECIFIC. The first segment names the stage
(DiagnosticStage) and is the only segment a consumer parses; the rest is
opaque identity. powerio never emits a code whose first segment is outside
the ten, so a downstream producer picks any other first segment and its
codes merge into one report without coordination.
The crate is a leaf on purpose: the transmission model, the distribution
model, and the .pio.json document model are peers, and a record that
crosses between them needs a home below all three.
use powerio_diag::{DiagnosticSeverity, DiagnosticStage, StructuredDiagnostic, render_line};
let d = StructuredDiagnostic::new(
"READ.DSS.INCLUDE_REFUSED",
DiagnosticSeverity::Error,
"redirect ../shared.dss: refused; the include escapes the case directory",
);
assert_eq!(d.stage(), Some(DiagnosticStage::Read));
assert!(render_line(&d).starts_with("READ.DSS.INCLUDE_REFUSED: "));Re-exports§
pub use category::ErrorCategory;pub use code::DiagnosticCode;pub use code::DiagnosticStage;pub use code::code_is_well_formed;pub use collect::Diagnostics;pub use record::DiagnosticSeverity;pub use record::SourceRef;pub use record::StructuredDiagnostic;pub use registry::CodeStatus;pub use registry::DiagnosticInfo;pub use registry::check_registry;pub use registry::check_scope_ownership;pub use render::render_line;pub use render::render_lines;
Modules§
- category
- The coarse projection of a fatal diagnostic, for callers that map onto their own taxonomy.
- code
- Diagnostic codes and the stage family their first segment names.
- collect
- The collector an emitting pass threads through its call tree.
- nonfinite
- JSON spellings for nonfinite floats, one convention for every document powerio authors.
- record
- The diagnostic record and the severity ladder.
- registry
- Registry entries: how a crate declares the codes it emits.
- render
- The one renderer behind every text warning channel.
Macros§
- diagnostic_
codes - Declare a crate’s registry: one
DiagnosticInfoconstant per code, plus theALLslice the gates run over.