pub enum JsonSerializationErrorKind {
IntegerOutOfRange {
signedness: JsonIntegerSignedness,
},
NonFiniteFloat,
InvalidNumberRepresentation,
UnsupportedMapKey {
kind: JsonMapKeyKind,
},
DuplicateObjectKey,
InvalidRawValue,
CollectionLengthOverflow {
kind: JsonCollectionKind,
},
InvalidSerializerState {
reason: JsonSerializerStateError,
},
DisplayFormattingFailed,
CustomSerialization,
}Expand description
Precise reason why a Serde value could not become strict JSON.
§Examples
use qubit_json::encode::JsonIntegerSignedness;
use qubit_json::encode::JsonSerializationErrorKind;
use qubit_json::value::JsonValueEncoder;
let error = JsonValueEncoder::new()
.encode(&u128::MAX)
.expect_err("wide integer must be rejected");
assert_eq!(
error.kind(),
JsonSerializationErrorKind::IntegerOutOfRange {
signedness: JsonIntegerSignedness::Unsigned,
},
);Variants§
IntegerOutOfRange
A signed or unsigned integer exceeded the strict 64-bit union range.
Fields
signedness: JsonIntegerSignednessSignedness of the rejected Serde integer entry point.
NonFiniteFloat
A floating-point value was NaN or infinite.
InvalidNumberRepresentation
A finite number unexpectedly could not become a serde_json number.
UnsupportedMapKey
A Serde value shape cannot be represented as an object key.
Fields
kind: JsonMapKeyKindRejected non-sensitive Serde shape.
DuplicateObjectKey
Two source entries produced the same JSON object key.
InvalidRawValue
A serde_json RawValue payload violated the strict value contract.
CollectionLengthOverflow
A JSON collection count overflowed the platform representation.
Fields
kind: JsonCollectionKindCollection whose count overflowed.
InvalidSerializerState
A hand-written Serialize implementation violated compound state rules.
Fields
reason: JsonSerializerStateErrorExact privacy-safe state violation.
DisplayFormattingFailed
A Display implementation rejected fallible formatting.
CustomSerialization
An external serializer returned opaque custom failure text.
Trait Implementations§
Source§impl Clone for JsonSerializationErrorKind
impl Clone for JsonSerializationErrorKind
Source§fn clone(&self) -> JsonSerializationErrorKind
fn clone(&self) -> JsonSerializationErrorKind
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for JsonSerializationErrorKind
Source§impl Debug for JsonSerializationErrorKind
impl Debug for JsonSerializationErrorKind
Source§impl Display for JsonSerializationErrorKind
impl Display for JsonSerializationErrorKind
impl Eq for JsonSerializationErrorKind
Source§impl Error for JsonSerializationErrorKind
impl Error for JsonSerializationErrorKind
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()