#[non_exhaustive]pub struct JsonDecodeError { /* private fields */ }Expand description
Error returned when lenient JSON decoding fails.
This type exposes immutable diagnostics so its error category, stage, and associated input metadata always remain consistent with one another.
Implementations§
Source§impl JsonDecodeError
impl JsonDecodeError
Sourcepub const fn kind(&self) -> JsonDecodeErrorKind
pub const fn kind(&self) -> JsonDecodeErrorKind
Sourcepub const fn stage(&self) -> JsonDecodeStage
pub const fn stage(&self) -> JsonDecodeStage
Returns the decoding stage that produced this error.
§Returns
The decoder stage where the failure occurred.
Sourcepub const fn privacy_policy(&self) -> ErrorPrivacyPolicy
pub const fn privacy_policy(&self) -> ErrorPrivacyPolicy
Returns the privacy policy applied when this error was constructed.
§Returns
The effective error privacy policy.
Sourcepub fn message(&self) -> &str
pub fn message(&self) -> &str
Returns the human-readable diagnostic message.
§Returns
The stable redacted message or explicitly requested detailed message.
Sourcepub const fn expected_top_level(&self) -> Option<JsonTopLevelKind>
pub const fn expected_top_level(&self) -> Option<JsonTopLevelKind>
Returns the required top-level JSON kind for a constrained decode.
§Returns
Some(kind) when constrained decoding rejected a valid top-level
value; otherwise, None.
Sourcepub const fn actual_top_level(&self) -> Option<JsonTopLevelKind>
pub const fn actual_top_level(&self) -> Option<JsonTopLevelKind>
Returns the observed top-level JSON kind for a constrained decode.
§Returns
Some(kind) when constrained decoding rejected a valid top-level
value; otherwise, None.
Sourcepub const fn raw_input_bytes(&self) -> usize
pub const fn raw_input_bytes(&self) -> usize
Sourcepub fn utf8_valid_up_to(&self) -> Option<usize>
pub fn utf8_valid_up_to(&self) -> Option<usize>
Returns the valid UTF-8 prefix length for invalid byte input.
§Returns
Some(length) for JsonDecodeErrorKind::InvalidUtf8, including zero
when the first byte is invalid; otherwise, None.
Sourcepub fn utf8_error_len(&self) -> Option<usize>
pub fn utf8_error_len(&self) -> Option<usize>
Returns the known length of the invalid UTF-8 sequence.
§Returns
Some(length) when the invalid sequence length is known, or None for
an incomplete trailing sequence and for non-UTF-8 errors.
Sourcepub const fn normalized_input_bytes(&self) -> Option<usize>
pub const fn normalized_input_bytes(&self) -> Option<usize>
Returns the byte length of normalized JSON text.
§Returns
Some(length) when normalization completed before the failure, or
None when the input was rejected before a normalized length existed.
Sourcepub const fn max_input_bytes(&self) -> Option<usize>
pub const fn max_input_bytes(&self) -> Option<usize>
Returns the configured raw-input limit for a size failure.
§Returns
Some(limit) when raw input exceeded its configured limit, or None
for normalized-size and non-size failures.
Sourcepub const fn max_normalized_bytes(&self) -> Option<usize>
pub const fn max_normalized_bytes(&self) -> Option<usize>
Returns the configured normalized-input limit for a size failure.
§Returns
Some(limit) when normalized JSON exceeded its configured limit, or
None for raw-size and non-size failures.
Sourcepub const fn normalized_line(&self) -> Option<usize>
pub const fn normalized_line(&self) -> Option<usize>
Returns the parser line in normalized JSON text.
§Returns
Some(line) with a one-based line number when serde reported one, or
None when no parser location is available.
Sourcepub const fn normalized_column(&self) -> Option<usize>
pub const fn normalized_column(&self) -> Option<usize>
Returns the parser column in normalized JSON text.
§Returns
Some(column) with a one-based column number when serde reported one,
or None when no parser location is available.
Trait Implementations§
Source§impl Clone for JsonDecodeError
impl Clone for JsonDecodeError
Source§fn clone(&self) -> JsonDecodeError
fn clone(&self) -> JsonDecodeError
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for JsonDecodeError
impl Debug for JsonDecodeError
Source§impl Display for JsonDecodeError
impl Display for JsonDecodeError
impl Eq for JsonDecodeError
Source§impl Error for JsonDecodeError
impl Error for JsonDecodeError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the decoder source under detailed privacy mode.
§Returns
Some(source) when detailed diagnostics expose a UTF-8 or serde
error, or None for redacted and source-free failures.
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()