meta_language/
verification.rs1use crate::link_network::LinkId;
2use crate::source::SourceSpan;
3
4#[derive(Clone, Copy, Debug, PartialEq, Eq)]
6pub enum VerificationIssueKind {
7 ErrorLink,
9 MissingLink,
11 HasErrorLink,
13}
14
15#[derive(Clone, Debug, PartialEq, Eq)]
17pub struct VerificationIssue {
18 link_id: LinkId,
19 kind: VerificationIssueKind,
20 span: Option<SourceSpan>,
21}
22
23impl VerificationIssue {
24 pub(crate) const fn new(
25 link_id: LinkId,
26 kind: VerificationIssueKind,
27 span: Option<SourceSpan>,
28 ) -> Self {
29 Self {
30 link_id,
31 kind,
32 span,
33 }
34 }
35
36 #[must_use]
38 pub const fn link_id(&self) -> LinkId {
39 self.link_id
40 }
41
42 #[must_use]
44 pub const fn kind(&self) -> VerificationIssueKind {
45 self.kind
46 }
47
48 #[must_use]
50 pub const fn span(&self) -> Option<SourceSpan> {
51 self.span
52 }
53}
54
55#[derive(Clone, Debug, PartialEq, Eq)]
57pub struct VerificationReport {
58 issues: Vec<VerificationIssue>,
59}
60
61impl VerificationReport {
62 pub(crate) const fn new(issues: Vec<VerificationIssue>) -> Self {
63 Self { issues }
64 }
65
66 #[must_use]
68 pub fn is_clean(&self) -> bool {
69 self.issues.is_empty()
70 }
71
72 #[must_use]
74 pub fn issues(&self) -> &[VerificationIssue] {
75 &self.issues
76 }
77}