11use crate :: download:: { CustomDownloadInstance , DownloadInstance } ;
22use crate :: rc:: { Array , CoreArrayProvider , CoreArrayProviderInner , Guard , Ref } ;
33use crate :: settings:: Settings ;
4- use crate :: string:: IntoCStr ;
4+ use crate :: string:: { BnString , IntoCStr } ;
55use binaryninjacore_sys:: * ;
66use std:: ffi:: c_void;
7+ use std:: fmt:: Debug ;
78use std:: mem:: MaybeUninit ;
89
910/// Register a new download provider type, which is used by the core (and other plugins) to make HTTP requests.
@@ -81,6 +82,10 @@ impl DownloadProvider {
8182 Self :: get ( & dp_name) . ok_or ( ( ) )
8283 }
8384
85+ pub fn name ( & self ) -> String {
86+ unsafe { BnString :: into_string ( BNGetDownloadProviderName ( self . handle ) ) }
87+ }
88+
8489 pub fn create_instance ( & self ) -> Result < Ref < DownloadInstance > , ( ) > {
8590 let result: * mut BNDownloadInstance =
8691 unsafe { BNCreateDownloadProviderInstance ( self . handle ) } ;
@@ -92,6 +97,14 @@ impl DownloadProvider {
9297 }
9398}
9499
100+ impl Debug for DownloadProvider {
101+ fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
102+ f. debug_struct ( "DownloadProvider" )
103+ . field ( "name" , & self . name ( ) )
104+ . finish ( )
105+ }
106+ }
107+
95108impl CoreArrayProvider for DownloadProvider {
96109 type Raw = * mut BNDownloadProvider ;
97110 type Context = ( ) ;
0 commit comments