imferno_core/assetmap/
volindex_codes.rs1use crate::diagnostics::codes::ValidationCode;
4use crate::diagnostics::{Category, Severity};
5
6#[derive(Debug, Clone, Copy, PartialEq, Eq, strum::EnumIter)]
8pub enum St429_9_2014 {
9 VolindexMissing,
11 MalformedXml,
13}
14
15impl ValidationCode for St429_9_2014 {
16 fn code(&self) -> &'static str {
17 match self {
18 Self::VolindexMissing => "ST429-9:2014:7/VolindexMissing",
19 Self::MalformedXml => "ST429-9:2014:7/MalformedXml",
20 }
21 }
22 fn description(&self) -> &'static str {
23 match self {
24 Self::VolindexMissing => "No volume-index document found in the package root.",
25 Self::MalformedXml => "The VOLINDEX.xml document is not well-formed XML.",
26 }
27 }
28 fn default_severity(&self) -> Severity {
29 match self {
30 Self::VolindexMissing => Severity::Info,
31 Self::MalformedXml => Severity::Error,
32 }
33 }
34 fn category(&self) -> Category {
35 Category::Structure
36 }
37 fn example(&self) -> Option<&'static str> {
38 Some(match self {
39 Self::VolindexMissing => {
40 "Package root contains ASSETMAP.xml and CPL/PKL XMLs but no VOLINDEX.xml."
41 }
42 Self::MalformedXml => {
43 "<VolumeIndex>1<!-- truncated --> — VOLINDEX.xml ends mid-element."
44 }
45 })
46 }
47}
48
49impl St429_9_2014 {
50 pub const ALL: &'static [Self] = &[Self::VolindexMissing, Self::MalformedXml];
51}
52
53impl From<St429_9_2014> for String {
54 fn from(c: St429_9_2014) -> String {
55 c.code().to_string()
56 }
57}