pub struct DiagnosticCode {
namespace: &'static str,
number: u32,
}Expand description
Stable, severity-free diagnostic identifier (manifest §16).
Rendered as a namespace followed by a zero-padded four-digit number,
e.g. MOS0010. Equality and hashing use the (namespace, number)
pair, so the display width can grow past four digits without breaking
tooling that keyed off the structured value.
§Examples
use mos_core::codes;
assert_eq!(codes::MOS0010.code().to_string(), "MOS0010");
assert_eq!(codes::MOS0010.code().number(), 10);Fields§
§namespace: &'static str§number: u32Implementations§
Source§impl DiagnosticCode
impl DiagnosticCode
Sourcepub const fn namespace(self) -> &'static str
pub const fn namespace(self) -> &'static str
The namespace segment (always "MOS" for compiler-native codes).
§Examples
use mos_core::codes;
assert_eq!(codes::MOS0033.code().namespace(), "MOS");Sourcepub const fn number(self) -> u32
pub const fn number(self) -> u32
The numeric portion, without zero-padding.
§Examples
use mos_core::codes;
assert_eq!(codes::MOS0033.code().number(), 33);pub(crate) const fn new(namespace: &'static str, number: u32) -> Self
Trait Implementations§
Source§impl Clone for DiagnosticCode
impl Clone for DiagnosticCode
Source§fn clone(&self) -> DiagnosticCode
fn clone(&self) -> DiagnosticCode
Returns a duplicate of the value. Read more
1.0.0 · 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 DiagnosticCode
impl Debug for DiagnosticCode
Source§impl Display for DiagnosticCode
impl Display for DiagnosticCode
Source§impl Hash for DiagnosticCode
impl Hash for DiagnosticCode
Source§impl Ord for DiagnosticCode
impl Ord for DiagnosticCode
Source§fn cmp(&self, other: &DiagnosticCode) -> Ordering
fn cmp(&self, other: &DiagnosticCode) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for DiagnosticCode
impl PartialEq for DiagnosticCode
Source§impl PartialOrd for DiagnosticCode
impl PartialOrd for DiagnosticCode
impl Copy for DiagnosticCode
impl Eq for DiagnosticCode
impl StructuralPartialEq for DiagnosticCode
Auto Trait Implementations§
impl Freeze for DiagnosticCode
impl RefUnwindSafe for DiagnosticCode
impl Send for DiagnosticCode
impl Sync for DiagnosticCode
impl Unpin for DiagnosticCode
impl UnsafeUnpin for DiagnosticCode
impl UnwindSafe for DiagnosticCode
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