#[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
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
impl DiagnosticCode
Sourcepub fn code(self) -> &'static str
pub fn code(self) -> &'static str
The stable RON-Pxxxx / RON-Vxxxx string for this code (part of the
public API).
Sourcepub fn default_severity(self) -> Severity
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.
Sourcepub fn source(self) -> &'static str
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
impl Clone for DiagnosticCode
Source§fn clone(&self) -> DiagnosticCode
fn clone(&self) -> DiagnosticCode
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more