pub struct Violation {
pub severity: ViolationSeverity,
pub category: ViolationCategory,
pub message: String,
pub element: Option<String>,
pub requirement: String,
pub rule_id: &'static str,
pub standard_refs: Vec<StandardRef>,
}Expand description
A compliance violation
Fields§
§severity: ViolationSeveritySeverity: error, warning, info
category: ViolationCategoryCategory of the violation
message: StringHuman-readable message
element: Option<String>Component or element that violated (if applicable)
requirement: StringStandard/requirement being violated
rule_id: &'static strStable internal rule key, set at the check site, indexing into
rule_meta. This — not the human-readable message — drives the
externally-visible SARIF rule ID, the harmonised-standard references,
and the remediation text. Defaults to "SBOM-CRA-GENERAL" for
violations built outside the checker (e.g., from external config).
Skipped during (de)serialization: it is a &'static str runtime index,
not part of the JSON contract. Round-tripped payloads resolve back to
the default; standard_refs already carries the serialized references.
standard_refs: Vec<StandardRef>Structured references to harmonised-standard / regulation clauses.
Populated by ComplianceChecker::check() from Violation::rule_id
via rule_meta. Empty when a violation’s rule maps to no references.
Implementations§
Source§impl Violation
impl Violation
Sourcepub fn registry_standard_refs(&self) -> Vec<StandardRef>
pub fn registry_standard_refs(&self) -> Vec<StandardRef>
Structured standard references for this violation, looked up from the
rule registry by Violation::rule_id.
References are returned in registry order — typically the most specific
harmonised-standard ID first, then the regulation reference. The
registry, not the human-readable requirement string, is the single
source of truth, so rewording a message can never silently drop a
prEN/BSI cross-reference.
ComplianceChecker::check() calls this once and stores the result in
Violation::standard_refs, so most consumers should read the field
directly rather than re-deriving.
Sourcepub fn remediation_guidance(&self) -> &'static str
pub fn remediation_guidance(&self) -> &'static str
Remediation guidance for this violation, looked up from the rule
registry by Violation::rule_id.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Violation
impl<'de> Deserialize<'de> for Violation
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for Violation
impl RefUnwindSafe for Violation
impl Send for Violation
impl Sync for Violation
impl Unpin for Violation
impl UnsafeUnpin for Violation
impl UnwindSafe for Violation
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more