imferno_core/diagnostics/codes.rs
1//! Shared validation-code infrastructure.
2//!
3//! This module defines the [`ValidationCode`] trait that every per-spec enum implements.
4//!
5//! Codes live in their spec's module:
6//! - [`crate::assetmap::volindex_codes`] — SMPTE ST 429-9 (VOLINDEX)
7//! - [`crate::assetmap::codes`] — SMPTE ST 2067-2 (AssetMap / PKL)
8//! - [`crate::cpl::codes`] — SMPTE ST 2067-3 (CPL)
9//! - [`crate::validation::codes`] — SMPTE ST 2067-21 (App2E)
10//! - [`crate::mxf::codes`] — SMPTE ST 377-1 (MXF)
11
12use super::{Category, Severity};
13
14// ─────────────────────────────────────────────────────────────────────────────
15// ValidationCode trait
16// ─────────────────────────────────────────────────────────────────────────────
17
18/// Metadata for a typed validation code.
19///
20/// Implement this trait on a per-spec enum to get a typed, iterable catalogue
21/// of all codes a spec emits, each with a canonical code string, description,
22/// default severity, and category.
23pub trait ValidationCode {
24 /// The canonical string written into [`crate::ValidationIssue::code`].
25 fn code(&self) -> &'static str;
26 /// A concise English description of what the constraint checks.
27 fn description(&self) -> &'static str;
28 /// The severity level assigned by the validator by default.
29 fn default_severity(&self) -> Severity;
30 /// The category bucket this code belongs to.
31 fn category(&self) -> Category;
32}