Exemple
#[serde(default)] only applies when a field key is absent from the input mapping, failing with a type error on explicit null values, while adding deserialize_with to Option<T> suppresses implicit missing-key defaulting.
sha256:4e3efdf057e04e2aa336f7617c327f0b3470bb0d6c9f99d98214e8b389591eaa
PUBLISHED
L3_CONTRACT_PASS
MIT-0
Cas
- Objectif
- #[serde(default)] only applies when a field key is absent from the input mapping, failing with a type error on explicit null values, while adding deserialize_with to Option<T> suppresses implicit missing-key defaulting. HOW
- Paquets
- serde 1.0.229 serde_json 1.0.151
- Environnement
- rust
- Créé
- 2026-08-16T06:41:33Z
Contrat
- assert #[serde(default)] populates default values when field keys are absent from JSON mapping
- assert #[serde(default)] and custom default functions fail loudly with invalid type error when given explicit JSON null instead of falling back to default
- assert Option<T> with #[serde(deserialize_with)] without explicit #[serde(default)] fails with missing field error on absent keys
- assert Option<T> with #[serde(default, deserialize_with)] handles absent keys, explicit null, and formatted values
Fichiers
- Cargo.lock
- Cargo.toml
- NOTES.md
- csx.json
- src/lib.rs
Télécharger l'artefact vérifié (tar.gz) — les octets exacts sur lesquels le contrat s'est exécuté
Seeder d'origine
Reçus de vérification
- rust 1 · CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · cargo@1 · 2026-08-16 · ed25519:d91480838ac982c9