pub struct Diagnostic { /* private fields */ }Expand description
A user-facing issue found in Achitekfile source.
Diagnostics carry stable machine-readable metadata that downstream tools can
map into their own reporting formats. For example, achitek-ls can convert
this type into an LSP diagnostic without defining its own Achitekfile
diagnostic codes.
§Examples
let source = r#"
blueprint {
version = "1.0.0"
name = "web-app"
}
prompt "project_name" {
help = "Project name"
}
"#;
let analysis = achitekfile::analyze(source)?;
let diagnostic = &analysis.diagnostics()[0];
assert_eq!(diagnostic.code(), achitekfile::DiagnosticCode::MissingPromptType);
assert_eq!(diagnostic.severity(), achitekfile::Severity::Error);
assert_eq!(diagnostic.kind(), achitekfile::DiagnosticKind::Semantic);Implementations§
Source§impl Diagnostic
impl Diagnostic
Sourcepub fn code(&self) -> DiagnosticCode
pub fn code(&self) -> DiagnosticCode
Returns the stable diagnostic code.
Sourcepub fn severity(&self) -> Severity
pub fn severity(&self) -> Severity
Returns how strongly tooling should surface this diagnostic.
Sourcepub fn kind(&self) -> DiagnosticKind
pub fn kind(&self) -> DiagnosticKind
Returns the broad analysis layer that produced this diagnostic.
Trait Implementations§
Source§impl Clone for Diagnostic
impl Clone for Diagnostic
Source§fn clone(&self) -> Diagnostic
fn clone(&self) -> Diagnostic
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for Diagnostic
impl Debug for Diagnostic
Source§impl Hash for Diagnostic
impl Hash for Diagnostic
Source§impl PartialEq for Diagnostic
impl PartialEq for Diagnostic
Source§fn eq(&self, other: &Diagnostic) -> bool
fn eq(&self, other: &Diagnostic) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Eq for Diagnostic
impl StructuralPartialEq for Diagnostic
Auto Trait Implementations§
impl Freeze for Diagnostic
impl RefUnwindSafe for Diagnostic
impl Send for Diagnostic
impl Sync for Diagnostic
impl Unpin for Diagnostic
impl UnsafeUnpin for Diagnostic
impl UnwindSafe for Diagnostic
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
Mutably borrows from an owned value. Read more