Usage
[]
= "0.1"
Problem
When using serde defaulting users currently have to manually create a Default implementations that matches the serde field level annotations.
If you use the regular #[derive(Default)], it you will get unexpected results.
For example:
The output is:
serde and Default do not match, this is a bug!
This is because the implementation of Default disagrees with the serde defaults.
If instead serde_serive_default::Default is used it will use the same annotations used by serde to create the default implementation:
The output is:
serde and Default match!
Note that tha above problem only manifests when using field level annotations. If you are using container level #[serde(default)] then the regular #[derive(Default)] or a manual implementation of Default will work as expected.