pub struct DiagnosticDef { /* private fields */ }Expand description
Registry entry: one code, its slug, default severity, category, owner, summary.
Constructed only by define_codes!. Fields are read through the
accessors; there is no public constructor and no public field, so an
outside crate cannot forge a def that reuses an existing code with a
different slug or severity.
§Examples
use mos_core::{DiagnosticCategory, Severity, codes};
assert_eq!(codes::MOS0018.default_severity(), Severity::Notice);
assert_eq!(codes::MOS0018.category(), DiagnosticCategory::Text);
assert_eq!(codes::MOS0018.owner(), "mos-fonts");Implementations§
Source§impl DiagnosticDef
impl DiagnosticDef
Sourcepub const fn code(&self) -> DiagnosticCode
pub const fn code(&self) -> DiagnosticCode
The stable identifier.
§Examples
use mos_core::codes;
assert_eq!(codes::MOS0033.code().to_string(), "MOS0033");Sourcepub const fn slug(&self) -> &'static str
pub const fn slug(&self) -> &'static str
The machine-readable kebab-case handle (e.g. "label-duplicate").
§Examples
use mos_core::codes;
assert_eq!(codes::MOS0033.slug(), "label-missing");Sourcepub const fn default_severity(&self) -> Severity
pub const fn default_severity(&self) -> Severity
The severity this code carries unless overridden by future config.
§Examples
use mos_core::{Severity, codes};
assert_eq!(codes::MOS0033.default_severity(), Severity::Error);Sourcepub const fn category(&self) -> DiagnosticCategory
pub const fn category(&self) -> DiagnosticCategory
What kind of thing this code describes. Used by the catalog to group rules; never folded into identity.
§Examples
use mos_core::{DiagnosticCategory, codes};
assert_eq!(codes::MOS0033.category(), DiagnosticCategory::Semantic);Trait Implementations§
Auto Trait Implementations§
impl Freeze for DiagnosticDef
impl RefUnwindSafe for DiagnosticDef
impl Send for DiagnosticDef
impl Sync for DiagnosticDef
impl Unpin for DiagnosticDef
impl UnsafeUnpin for DiagnosticDef
impl UnwindSafe for DiagnosticDef
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