File tree Expand file tree Collapse file tree 2 files changed +4
-5
lines changed Expand file tree Collapse file tree 2 files changed +4
-5
lines changed Original file line number Diff line number Diff line change 11mod build_utils;
22use bindgen:: Builder ;
33use std:: collections:: HashMap ;
4- use std:: vec:: Vec ;
54
65
76fn main ( ) {
87 println ! ( "cargo:rustc-link-search=../c/target" ) ;
98
10- let borsh_derives: Vec < String > = vec ! [ "BorshSerialize" . to_string ( ) , "BorshDeserialize" . to_string ( ) ] ;
9+ let borsh_derives: & [ & str ] = & [ "BorshSerialize" , "BorshDeserialize" ] ;
1110
1211 let parser = build_utils:: DeriveAdderParserCallback { types_to_traits : HashMap :: from ( [
13- ( "cmd_hdr" , borsh_derives)
12+ ( "cmd_hdr" , borsh_derives) , ( "cmd_upd_price" , borsh_derives )
1413 //map more struct names to traits here, be sure that the definitions of your traites
1514 //are included in c_oracle_header.rs
1615 ] ) } ;
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ use std::collections::HashMap;
88///is provided as a ParseCallback for bindgen
99#[ derive( Debug ) ]
1010pub struct DeriveAdderParserCallback < ' a > {
11- pub types_to_traits : HashMap < & ' a str , Vec < String > > ,
11+ pub types_to_traits : HashMap < & ' a str , & ' a [ & ' a str ] > ,
1212}
1313
1414//this is required to implement the callback trait
@@ -18,7 +18,7 @@ impl ParseCallbacks for DeriveAdderParserCallback<'_>{
1818 fn add_derives ( & self , _name : & str ) -> Vec < String > {
1919 let traits = self . types_to_traits . get ( _name) ;
2020 match traits{
21- Some ( trait_names) =>trait_names. to_vec ( ) ,
21+ Some ( trait_names) =>trait_names. to_vec ( ) . iter ( ) . map ( |s| s . to_string ( ) ) . collect ( ) ,
2222 None => vec ! [ ] ,
2323 }
2424 }
You can’t perform that action at this time.
0 commit comments