mirror of
https://github.com/pezkuwichain/serde.git
synced 2026-04-23 05:58:01 +00:00
feat(codegen): Allow #[serde(default="123")]
This feature adds support for the default to be specified to be some expression (which unfortunately needs to be parsed from a string) without needing this value to have an implementation of `Default`, or for a new-type wrapper in order to provide an alternative implementation. This expression is run in a function, and therefore has no access to any of the internal state of the deserializer.
This commit is contained in:
@@ -605,7 +605,7 @@ fn serialize_struct_visitor<I>(
|
||||
{
|
||||
let value_exprs = value_exprs.collect::<Vec<_>>();
|
||||
|
||||
let field_attrs = try!(attr::get_struct_field_attrs(cx, fields));
|
||||
let field_attrs = try!(attr::get_struct_field_attrs(cx, generics, fields));
|
||||
|
||||
let arms: Vec<ast::Arm> = field_attrs.iter()
|
||||
.zip(value_exprs.iter())
|
||||
|
||||
Reference in New Issue
Block a user