pub trait ValidationCode {
// Required methods
fn code(&self) -> &'static str;
fn description(&self) -> &'static str;
fn default_severity(&self) -> Severity;
fn category(&self) -> Category;
// Provided methods
fn example(&self) -> Option<&'static str> { ... }
fn previous_identical_edition(&self) -> Option<&'static str> { ... }
}Expand description
Metadata for a typed validation code.
Implement this trait on a per-spec enum to get a typed, iterable catalogue of all codes a spec emits, each with a canonical code string, description, default severity, and category.
Required Methods§
Sourcefn code(&self) -> &'static str
fn code(&self) -> &'static str
The canonical string written into crate::ValidationIssue::code.
Sourcefn description(&self) -> &'static str
fn description(&self) -> &'static str
A concise English description of what the constraint checks.
Sourcefn default_severity(&self) -> Severity
fn default_severity(&self) -> Severity
The severity level assigned by the validator by default.
Provided Methods§
Sourcefn example(&self) -> Option<&'static str>
fn example(&self) -> Option<&'static str>
One-line snippet illustrating what a violation looks like in
the source artefact. Defaults to None; per-code
implementations override.
Authoring guidance: prefer a minimal XML / value fragment over prose, so operators can scan and recognize the pattern.
Sourcefn previous_identical_edition(&self) -> Option<&'static str>
fn previous_identical_edition(&self) -> Option<&'static str>
Prefix of the prior spec edition whose code set is bit-for-bit
identical to this one — e.g. "ST2067-3:2013" for
St2067_3_2016 (the canonical 2016 XSD body is unchanged from
2013). Used by listRules and downstream UIs to group / hide
duplicate cross-edition catalogues without re-diffing on the
consumer side.
Defaults to None; per-enum implementations override when the
edition is confirmed identical to its predecessor (verified by
the snapshot diff documented in docs/catalogue-todos.md
Item 2).
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".