Browse Source

fix field index in proc derive

preview
Stefan Bühler 2 years ago
parent
commit
2ee16d7994
  1. 1
      lib/dnsbox-derive/src/dns_packet_data.rs
  2. 1
      lib/dnsbox-derive/src/dns_text_data.rs

1
lib/dnsbox-derive/src/dns_packet_data.rs

@ -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))?,

1
lib/dnsbox-derive/src/dns_text_data.rs

@ -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))?,

Loading…
Cancel
Save