mirror of
https://github.com/serde-rs/serde.git
synced 2025-09-30 22:41:31 +00:00

This allows structs to use the default value for each field defined in the struct’s `std::default::Default` implementation, rather then the default value for the field’s type. ``` struct StructDefault { a: i32, b: String, } impl Default for StructDefault { fn default() -> StructDefault { StructDefault{ a: 100, b: "default".to_string(), } } } ``` The code above will now return `100` for field `a` and `”default”` for `b`, rather then `0` and `””` respectively.