Ignore skipped fields

This commit is contained in:
Osspial
2018-04-09 23:43:49 -04:00
parent c413775574
commit fd14332729
3 changed files with 22 additions and 10 deletions
+7 -2
View File
@@ -131,8 +131,13 @@ fn build_generics(cont: &Container) -> syn::Generics {
let generics = bound::without_defaults(cont.generics);
let trait_bound = parse_quote!(_serde::Serialize);
let generics =
bound::with_where_predicates_from_fields(cont, &generics, &trait_bound, attr::Field::ser_bound, attr::Field::serialize_with);
let generics = bound::with_where_predicates_from_fields(
cont,
&generics,
&trait_bound,
attr::Field::ser_bound,
|field| field.serialize_with().is_none() && !field.skip_serializing()
);
match cont.attrs.ser_bound() {
Some(predicates) => bound::with_where_predicates(&generics, predicates),