use crate::link_network::LinkId;
use crate::source::SourceSpan;
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum VerificationIssueKind {
ErrorLink,
MissingLink,
HasErrorLink,
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct VerificationIssue {
link_id: LinkId,
kind: VerificationIssueKind,
span: Option<SourceSpan>,
}
impl VerificationIssue {
pub(crate) const fn new(
link_id: LinkId,
kind: VerificationIssueKind,
span: Option<SourceSpan>,
) -> Self {
Self {
link_id,
kind,
span,
}
}
#[must_use]
pub const fn link_id(&self) -> LinkId {
self.link_id
}
#[must_use]
pub const fn kind(&self) -> VerificationIssueKind {
self.kind
}
#[must_use]
pub const fn span(&self) -> Option<SourceSpan> {
self.span
}
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct VerificationReport {
issues: Vec<VerificationIssue>,
}
impl VerificationReport {
pub(crate) const fn new(issues: Vec<VerificationIssue>) -> Self {
Self { issues }
}
#[must_use]
pub fn is_clean(&self) -> bool {
self.issues.is_empty()
}
#[must_use]
pub fn issues(&self) -> &[VerificationIssue] {
&self.issues
}
}