@@ -77,55 +77,67 @@ impl ReportCollection {
7777 }
7878 }
7979
80- pub fn add_text ( & self , view : & BinaryView , title : & str , contents : & str ) {
80+ pub fn add_text ( & self , view : Option < & BinaryView > , title : & str , contents : & str ) {
8181 let title = title. to_cstr ( ) ;
8282 let contents = contents. to_cstr ( ) ;
8383 unsafe {
8484 BNAddPlainTextReportToCollection (
8585 self . handle . as_ptr ( ) ,
86- view. handle ,
86+ view. map ( |v| v . handle ) . unwrap_or ( std :: ptr :: null_mut ( ) ) ,
8787 title. as_ptr ( ) ,
8888 contents. as_ptr ( ) ,
8989 )
9090 }
9191 }
9292
93- pub fn add_markdown ( & self , view : & BinaryView , title : & str , contents : & str , plaintext : & str ) {
93+ pub fn add_markdown (
94+ & self ,
95+ view : Option < & BinaryView > ,
96+ title : & str ,
97+ contents : & str ,
98+ plaintext : & str ,
99+ ) {
94100 let title = title. to_cstr ( ) ;
95101 let contents = contents. to_cstr ( ) ;
96102 let plaintext = plaintext. to_cstr ( ) ;
97103 unsafe {
98104 BNAddMarkdownReportToCollection (
99105 self . handle . as_ptr ( ) ,
100- view. handle ,
106+ view. map ( |v| v . handle ) . unwrap_or ( std :: ptr :: null_mut ( ) ) ,
101107 title. as_ptr ( ) ,
102108 contents. as_ptr ( ) ,
103109 plaintext. as_ptr ( ) ,
104110 )
105111 }
106112 }
107113
108- pub fn add_html ( & self , view : & BinaryView , title : & str , contents : & str , plaintext : & str ) {
114+ pub fn add_html (
115+ & self ,
116+ view : Option < & BinaryView > ,
117+ title : & str ,
118+ contents : & str ,
119+ plaintext : & str ,
120+ ) {
109121 let title = title. to_cstr ( ) ;
110122 let contents = contents. to_cstr ( ) ;
111123 let plaintext = plaintext. to_cstr ( ) ;
112124 unsafe {
113125 BNAddHTMLReportToCollection (
114126 self . handle . as_ptr ( ) ,
115- view. handle ,
127+ view. map ( |v| v . handle ) . unwrap_or ( std :: ptr :: null_mut ( ) ) ,
116128 title. as_ptr ( ) ,
117129 contents. as_ptr ( ) ,
118130 plaintext. as_ptr ( ) ,
119131 )
120132 }
121133 }
122134
123- pub fn add_graph ( & self , view : & BinaryView , title : & str , graph : & FlowGraph ) {
135+ pub fn add_graph ( & self , view : Option < & BinaryView > , title : & str , graph : & FlowGraph ) {
124136 let title = title. to_cstr ( ) ;
125137 unsafe {
126138 BNAddGraphReportToCollection (
127139 self . handle . as_ptr ( ) ,
128- view. handle ,
140+ view. map ( |v| v . handle ) . unwrap_or ( std :: ptr :: null_mut ( ) ) ,
129141 title. as_ptr ( ) ,
130142 graph. handle ,
131143 )
0 commit comments