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
@@ -188,7 +187,7 @@ fn parse_derive_input(input: &DeriveInput) -> Result<DeriveData, syn::Error> {
188187 } ;
189188
190189 // Find all fields with a `#[property]` attribute
191- let mut properties = HashMap :: new ( ) ;
190+ let mut properties = Vec :: new ( ) ;
192191
193192 if let Fields :: Named ( names) = & struct_data. fields {
194193 for field in & names. named {
@@ -232,7 +231,7 @@ fn parse_derive_input(input: &DeriveInput) -> Result<DeriveData, syn::Error> {
232231 . ident
233232 . clone ( )
234233 . ok_or_else ( || syn:: Error :: new ( field. ident . span ( ) , "Fields should be named" ) ) ?;
235- properties. insert ( ident, builder. done ( ) ) ;
234+ properties. push ( ( ident, builder. done ( ) ) ) ;
236235 }
237236 }
238237 } ;
0 commit comments