Skip to main content

null_default

Function null_default 

Source
pub fn null_default<'de, D, T>(deserializer: D) -> Result<T, D::Error>
where D: Deserializer<'de>, T: Deserialize<'de> + Default,
Expand description

Decode null as the type’s default rather than as a failure.

Applied to every composite field — see the module docs for why a null arrives at all, and why scalars deliberately do not get this treatment.

§Errors

Propagates the underlying decode failure for anything that is neither null nor a valid value of the field’s type.