1
1
use proc_macro:: TokenStream ;
2
2
use proc_macro2:: TokenStream as TokenStream2 ;
3
3
4
- use std:: collections:: HashMap ;
5
4
use syn:: spanned:: Spanned ;
6
5
use syn:: { Data , DeriveInput , Fields , Ident , Meta , MetaList , NestedMeta , Path , Stmt , Type } ;
7
6
@@ -13,7 +12,7 @@ pub(crate) struct DeriveData {
13
12
pub ( crate ) base : Type ,
14
13
pub ( crate ) register_callback : Option < Path > ,
15
14
pub ( crate ) user_data : Type ,
16
- pub ( crate ) properties : HashMap < Ident , PropertyAttrArgs > ,
15
+ pub ( crate ) properties : Vec < ( Ident , PropertyAttrArgs ) > ,
17
16
pub ( crate ) no_constructor : bool ,
18
17
}
19
18
@@ -188,7 +187,7 @@ fn parse_derive_input(input: &DeriveInput) -> Result<DeriveData, syn::Error> {
188
187
} ;
189
188
190
189
// Find all fields with a `#[property]` attribute
191
- let mut properties = HashMap :: new ( ) ;
190
+ let mut properties = Vec :: new ( ) ;
192
191
193
192
if let Fields :: Named ( names) = & struct_data. fields {
194
193
for field in & names. named {
@@ -232,7 +231,7 @@ fn parse_derive_input(input: &DeriveInput) -> Result<DeriveData, syn::Error> {
232
231
. ident
233
232
. clone ( )
234
233
. 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 ( ) ) ) ;
236
235
}
237
236
}
238
237
} ;
0 commit comments