pub struct DuplicateKeyRejectingJsonValueSeed;Expand description
Serde seed that constructs a DuplicateKeyRejectingJsonValue.
Use this seed when the caller owns a deserializer and needs duplicate-key rejection without requiring an intermediate typed wrapper.
Native i64, u64, and finite f64 events retain their numeric
representation. If an upstream deserializer exposes an arbitrary-precision
number as map events, this seed treats those events as an ordinary object
because it cannot determine their provenance. Lexical admission by
crate::decode::JsonDecoder does not change the subsequent Serde event
representation. See DuplicateKeyRejectingJsonValue for the corresponding
wrapper behavior and doc/number_contract.md in the repository for the
numeric contract.
For complete JSON input with native numeric events across feature
unification, use crate::decode::JsonDecoder::decode_unique_seed_utf8.
§Examples
use qubit_json::value::DuplicateKeyRejectingJsonValueSeed;
use serde::de::DeserializeSeed;
let mut deserializer = serde_json::Deserializer::from_str(r#"{"ok":true}"#);
let value = DuplicateKeyRejectingJsonValueSeed::new().deserialize(&mut deserializer)?;
assert_eq!(value.into_inner()["ok"], true);Implementations§
Trait Implementations§
impl Copy for DuplicateKeyRejectingJsonValueSeed
Source§impl<'de> DeserializeSeed<'de> for DuplicateKeyRejectingJsonValueSeed
impl<'de> DeserializeSeed<'de> for DuplicateKeyRejectingJsonValueSeed
Source§type Value = DuplicateKeyRejectingJsonValue
type Value = DuplicateKeyRejectingJsonValue
The owned JSON value produced after duplicate keys are rejected.
Source§fn deserialize<D>(self, deserializer: D) -> Result<Self::Value, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(self, deserializer: D) -> Result<Self::Value, D::Error>where
D: Deserializer<'de>,
Deserializes one JSON value with recursive duplicate-key rejection.
§Returns
The materialized JSON value after every object has passed duplicate-key validation.
§Errors
Returns the deserializer’s error if it cannot decode the value or if any object contains a duplicate key.
§Type Parameters
Dis the deserializer that supplies the value’s Serde events.
§Parameters
deserializersupplies the value to decode. Object entries are checked recursively for duplicate keys.