pub struct Diagnostic {
pub code: DiagnosticCode,
pub span: Span,
pub severity: DiagnosticSeverity,
pub message: String,
}Expand description
Diagnostic entry emitted by markdown analysis.
Fields§
§code: DiagnosticCodeStable diagnostic code identifier.
span: SpanSource span where the issue applies.
severity: DiagnosticSeveritySeverity level.
message: StringUser-facing diagnostic message.
Implementations§
Source§impl Diagnostic
impl Diagnostic
Sourcepub fn code_id(&self) -> &'static str
pub fn code_id(&self) -> &'static str
Stable external code id from catalog (e.g. MD103) for this diagnostic.
Sourcepub fn fix_suggestion(&self) -> &'static str
pub fn fix_suggestion(&self) -> &'static str
Stable quick fix suggestion associated with this diagnostic code.
Sourcepub fn catalog_entry(&self) -> Option<&'static DiagnosticsCatalogEntry>
pub fn catalog_entry(&self) -> Option<&'static DiagnosticsCatalogEntry>
Optional embedded catalog entry for this diagnostic.
Sourcepub fn title_resolved(&self) -> Option<&'static str>
pub fn title_resolved(&self) -> Option<&'static str>
Human title from embedded catalog if present.
Sourcepub fn description_resolved(&self) -> Option<&'static str>
pub fn description_resolved(&self) -> Option<&'static str>
Rich description from embedded catalog if present.
Sourcepub fn fix_suggestion_resolved(&self) -> Cow<'static, str>
pub fn fix_suggestion_resolved(&self) -> Cow<'static, str>
Resolve fix suggestion from embedded catalog when available, with a stable in-code fallback.
Sourcepub fn parse_error_at(position: Position, message: impl Into<String>) -> Self
pub fn parse_error_at(position: Position, message: impl Into<String>) -> Self
Build a parse-failure diagnostic anchored at a specific position.
Sourcepub fn parse_error(message: impl Into<String>) -> Self
pub fn parse_error(message: impl Into<String>) -> Self
Build a parse-failure diagnostic at a safe default location (1:1).
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 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 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