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
@@ -185,7 +184,7 @@ fn parse_derive_input(input: &DeriveInput) -> Result<DeriveData, syn::Error> {
185
184
} ;
186
185
187
186
// Find all fields with a `#[property]` attribute
188
- let mut properties = HashMap :: new ( ) ;
187
+ let mut properties = Vec :: new ( ) ;
189
188
190
189
if let Fields :: Named ( names) = & struct_data. fields {
191
190
for field in & names. named {
@@ -229,7 +228,7 @@ fn parse_derive_input(input: &DeriveInput) -> Result<DeriveData, syn::Error> {
229
228
. ident
230
229
. clone ( )
231
230
. 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 ( ) ) ) ;
233
232
}
234
233
}
235
234
} ;
0 commit comments