Skip to main content

DiagnosticCode

Enum DiagnosticCode 

Source
#[non_exhaustive]
pub enum DiagnosticCode { UnexpectedToken, UnclosedDelimiter, NestingDepthExceeded, MissingSeparator, MissingValue, TypeMismatch, MissingRequiredField, InvalidEnumVariant, WrongTupleArity, ValueConstraintViolation, UnknownField, }
Expand description

A stable, namespaced diagnostic code from the RON-Pxxxx parse registry or the RON-Vxxxx type/validation registry (AD-003 / TR-013, E006/FR-007).

Every variant maps 1:1 to a fixed RON-Pxxxx / RON-Vxxxx string via DiagnosticCode::code, and to a producing crate via DiagnosticCode::source ("ronin-core" for RON-P, "ronin-types" for RON-V). The enum is #[non_exhaustive] so new codes can be appended without a breaking change, but existing variants, their code strings, and their default severities are stable across 0.x. The RON-V validation codes are owned here as a shared registry; ronin-core never emits them (it stays rowan-only) — the downstream ronin-validate crate does.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

UnexpectedToken

RON-P0001 — an unexpected token at a position where a value (or other construct) was expected; the token was wrapped in an Error node.

§

UnclosedDelimiter

RON-P0002 — a delimiter ((, [, {) was opened but never closed before end-of-input; the matching close was synthesized as missing.

§

NestingDepthExceeded

RON-P0003 — nesting/recursion depth exceeded the configured guard (default 128); descent stopped and the remaining bytes were tokenized into Error nodes (no stack overflow, INV-5).

§

MissingSeparator

RON-P0004 — a : separator was expected in a struct field or map entry but was absent; recovery continued with a missing separator.

§

MissingValue

RON-P0005 — a struct field or map entry was missing its value after a separator; an empty/missing value node was recorded.

§

TypeMismatch

RON-V0001 — a value’s type does not match the bound type model (e.g. a string where an integer is expected). Emitted by ronin-validate (FR-002); Severity::Error.

§

MissingRequiredField

RON-V0002 — a field required by the bound type model is absent from a struct/map. Emitted by ronin-validate (FR-002); Severity::Error.

§

InvalidEnumVariant

RON-V0003 — an enum variant is not one of the variants the bound type model allows (invalid/unknown variant). Emitted by ronin-validate (FR-002); Severity::Error.

§

WrongTupleArity

RON-V0004 — a tuple (or tuple-struct/tuple-variant) has the wrong arity for the bound type model. Emitted by ronin-validate (FR-002); Severity::Error.

§

ValueConstraintViolation

RON-V0005 — a value violates a value constraint the bound type model expresses (out-of-range numeric, length/pattern bound, etc.). Emitted by ronin-validate (FR-002); Severity::Error.

§

UnknownField

RON-V0006 — an extra/unknown field is present on a struct/map the bound type model marks deny_unknown_fields. Serde-faithful: only flagged for strict types (FR-018). Emitted by ronin-validate; Severity::Warning.

Implementations§

Source§

impl DiagnosticCode

Source

pub fn code(self) -> &'static str

The stable RON-Pxxxx / RON-Vxxxx string for this code (part of the public API).

Source

pub fn default_severity(self) -> Severity

The default Severity for this code. All parse-recovery (RON-P) codes are Severity::Error. Among the type/validation (RON-V) codes, the hard-mismatch classes — type mismatch, missing-required, invalid variant, wrong arity, value-constraint — are Severity::Error, while an extra/unknown field is a Severity::Warning (FR-005, FR-018). The mapping is part of the stable contract.

Source

pub fn source(self) -> &'static str

The stable source tag identifying which crate produces this code (E006/FR-007). It is derived from the code-string namespace prefix: "ronin-types" for any RON-V validation code and "ronin-core" for any RON-P parse/recovery code. This tag lets a surface distinguish type findings from structural ones when rendering or deduping. Total and stable across 0.x.

Trait Implementations§

Source§

impl Clone for DiagnosticCode

Source§

fn clone(&self) -> DiagnosticCode

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for DiagnosticCode

Source§

impl Debug for DiagnosticCode

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for DiagnosticCode

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for DiagnosticCode

Source§

impl Hash for DiagnosticCode

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Ord for DiagnosticCode

Source§

fn cmp(&self, other: &DiagnosticCode) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 (const: unstable) · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 (const: unstable) · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

fn clamp_to<R>(self, range: R) -> Self
where Self: Sized, R: ClampBounds<Self>,

🔬This is a nightly-only experimental API. (clamp_to)
Restrict a value to a certain range. Read more
Source§

impl PartialEq for DiagnosticCode

Source§

fn eq(&self, other: &DiagnosticCode) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl PartialOrd for DiagnosticCode

Source§

fn partial_cmp(&self, other: &DiagnosticCode) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl StructuralPartialEq for DiagnosticCode

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.