fix field index in proc derive

This commit is contained in:
Stefan Bühler 2019-09-08 15:34:50 +02:00
parent 9ff91eeffb
commit 2ee16d7994
2 changed files with 2 additions and 0 deletions

View File

@ -54,6 +54,7 @@ fn derive_unnamed(s: &synstructure::Structure, fields: &syn::FieldsUnnamed) -> T
let mut parse_fields = quote!{};
let mut serialize_fields = quote!{};
for field in 0..fields.unnamed.len() {
let field = syn::Index::from(field);
parse_fields.extend(quote!{
DnsPacketData::deserialize(_data)
.with_context(|e| format!("failed parsing field {}::{}: {}", stringify!(#name), #field, e))?,

View File

@ -53,6 +53,7 @@ fn derive_unnamed(s: &synstructure::Structure, fields: &syn::FieldsUnnamed) -> T
let mut parse_fields = quote!{};
let mut format_fields = quote!{};
for field in 0..fields.unnamed.len() {
let field = syn::Index::from(field);
parse_fields.extend(quote!{
DnsTextData::dns_parse(_context, _data)
.with_context(|e| format!("failed parsing field {}::{}: {}", stringify!(#name), #field, e))?,