We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2629453 commit 27978f9Copy full SHA for 27978f9
hdf5-derive/src/lib.rs
@@ -9,8 +9,8 @@ use std::str::FromStr;
9
use proc_macro2::{Ident, Span, TokenStream};
10
use quote::{quote, ToTokens};
11
use syn::{
12
- parse_macro_input, AttrStyle, Attribute, Data, DeriveInput, Expr, Fields, Meta, NestedMeta,
13
- Type, TypeGenerics, TypePath,
+ parse_macro_input, AttrStyle, Attribute, Data, DeriveInput, Expr, Fields, Index,
+ Meta, NestedMeta, Type, TypeGenerics, TypePath,
14
};
15
16
#[proc_macro_derive(H5Type)]
@@ -146,11 +146,12 @@ fn impl_trait(
146
impl_compound(ty, ty_generics, &fields, &names, &types)
147
}
148
Fields::Unnamed(ref fields) => {
149
- let (index, fields): (Vec<usize>, Vec<_>) = fields
+ let (index, fields): (Vec<Index>, Vec<_>) = fields
150
.unnamed
151
.iter()
152
.enumerate()
153
.filter(|&(_, f)| !is_phantom_data(&f.ty))
154
+ .map(|(i, f)| (Index::from(i), f))
155
.unzip();
156
if fields.is_empty() {
157
panic!("Cannot derive H5Type for empty tuple structs");
0 commit comments