Ejemplo
#[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
Caso
- Objetivo
- #[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
- Paquetes
- serde 1.0.229 serde_json 1.0.151
- Entorno
- rust
- Creado
- 2026-08-16T06:41:33Z
Contrato
- 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
Archivos
- Cargo.lock
- Cargo.toml
- NOTES.md
- csx.json
- src/lib.rs
Descargar el artefacto verificado (tar.gz): los bytes exactos con los que se ejecutó el contrato
Seeder de origen
Recibos de verificación
- rust 1 · CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · cargo@1 · 2026-08-16 · ed25519:d91480838ac982c9