pub enum JsonSyntaxErrorReason {
Show 15 variants
UnexpectedEnd,
UnexpectedByte,
ExpectedColon,
ExpectedCommaOrArrayEnd,
ExpectedCommaOrObjectEnd,
ExpectedObjectKey,
InvalidEscape,
InvalidUnicodeEscape,
UnpairedSurrogate,
InvalidUtf8,
InvalidNumber,
IntegerOutOfRange,
FloatOutOfRange,
TrailingCharacters,
NestingOverflow,
}Expand description
The concrete reason why a JSON document was rejected lexically.
This enum intentionally remains exhaustive so callers can classify every
documented lexical rejection at compile time. New reasons require a
breaking release rather than a #[non_exhaustive] change.
§Examples
use qubit_json::decode::JsonSyntaxErrorReason;
let reason = JsonSyntaxErrorReason::UnexpectedByte;
assert_eq!(reason.to_string(), "unexpected byte");Variants§
UnexpectedEnd
The document ended before a complete token or container was found.
UnexpectedByte
A byte is not valid at the current JSON position.
The byte itself is intentionally not retained, so default structured diagnostics never expose input content.
ExpectedColon
An object key was not followed by a colon.
ExpectedCommaOrArrayEnd
An array value was not followed by a comma or closing bracket.
ExpectedCommaOrObjectEnd
An object value was not followed by a comma or closing brace.
ExpectedObjectKey
An object key was expected at the current position.
InvalidEscape
A string escape sequence is invalid.
InvalidUnicodeEscape
A Unicode escape does not contain four hexadecimal digits.
UnpairedSurrogate
A Unicode surrogate pair is malformed.
InvalidUtf8
The input contains invalid UTF-8.
InvalidNumber
A number does not follow JSON number grammar.
IntegerOutOfRange
An integer is outside the supported i64/u64 range.
FloatOutOfRange
A fractional or exponential number is outside finite f64 range.
TrailingCharacters
Non-whitespace bytes follow the complete root value.
NestingOverflow
A nesting or position counter overflowed.
Trait Implementations§
Source§impl Clone for JsonSyntaxErrorReason
impl Clone for JsonSyntaxErrorReason
Source§fn clone(&self) -> JsonSyntaxErrorReason
fn clone(&self) -> JsonSyntaxErrorReason
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more