File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -14,7 +14,6 @@ fn main() {
1414 parser. register_traits ( "pc_price_info" , borsh_derives. to_vec ( ) ) ;
1515 parser. register_traits ( "cmd_upd_price" , borsh_derives. to_vec ( ) ) ;
1616
17-
1817 //generate and write bindings
1918 let bindings = Builder :: default ( )
2019 . header ( "./src/bindings.h" )
Original file line number Diff line number Diff line change @@ -24,6 +24,17 @@ impl<'a> DeriveAdderParserCallback<'a> {
2424 }
2525}
2626
27+ impl < ' a > DeriveAdderParserCallback < ' a > {
28+ ///create a parser that does not add any traits
29+ pub fn new ( ) -> Self {
30+ Default :: default ( )
31+ }
32+ //add pairs of types and their desired traits
33+ pub fn register_traits ( & mut self , type_name : & ' a str , traits : Vec < String > ) {
34+ self . types_to_traits . insert ( & type_name, traits) ;
35+ }
36+ }
37+
2738//this is required to implement the callback trait
2839impl UnwindSafe for DeriveAdderParserCallback < ' _ > { }
2940
You can’t perform that action at this time.
0 commit comments