11use proc_macro:: TokenStream ;
22use proc_macro2:: TokenStream as TokenStream2 ;
33
4- use std:: collections:: HashMap ;
54use syn:: spanned:: Spanned ;
65use syn:: { Data , DeriveInput , Fields , Ident , Meta , MetaList , NestedMeta , Path , Stmt , Type } ;
76
@@ -13,7 +12,7 @@ pub(crate) struct DeriveData {
1312 pub ( crate ) base : Type ,
1413 pub ( crate ) register_callback : Option < Path > ,
1514 pub ( crate ) user_data : Type ,
16- pub ( crate ) properties : HashMap < Ident , PropertyAttrArgs > ,
15+ pub ( crate ) properties : Vec < ( Ident , PropertyAttrArgs ) > ,
1716 pub ( crate ) no_constructor : bool ,
1817}
1918
@@ -185,7 +184,7 @@ fn parse_derive_input(input: &DeriveInput) -> Result<DeriveData, syn::Error> {
185184 } ;
186185
187186 // Find all fields with a `#[property]` attribute
188- let mut properties = HashMap :: new ( ) ;
187+ let mut properties = Vec :: new ( ) ;
189188
190189 if let Fields :: Named ( names) = & struct_data. fields {
191190 for field in & names. named {
@@ -229,7 +228,7 @@ fn parse_derive_input(input: &DeriveInput) -> Result<DeriveData, syn::Error> {
229228 . ident
230229 . clone ( )
231230 . ok_or_else ( || syn:: Error :: new ( field. ident . span ( ) , "Fields should be named" ) ) ?;
232- properties. insert ( ident, builder. done ( ) ) ;
231+ properties. push ( ( ident, builder. done ( ) ) ) ;
233232 }
234233 }
235234 } ;
0 commit comments