11use crate :: rc:: { Array , Ref } ;
22use crate :: repository:: Repository ;
33use crate :: string:: IntoCStr ;
4- use binaryninjacore_sys:: { BNRepositoryGetRepositoryByPath ,
5- BNRepositoryManagerAddRepository , BNRepositoryManagerCheckForUpdates ,
6- BNRepositoryManagerGetDefaultRepository , BNRepositoryManagerGetRepositories ,
4+ use binaryninjacore_sys:: {
5+ BNRepositoryGetRepositoryByPath , BNRepositoryManagerAddRepository ,
6+ BNRepositoryManagerCheckForUpdates , BNRepositoryManagerGetDefaultRepository ,
7+ BNRepositoryManagerGetRepositories ,
78} ;
89use std:: fmt:: Debug ;
910use std:: path:: Path ;
@@ -22,8 +23,7 @@ impl RepositoryManager {
2223 /// List of [`Repository`] objects being managed
2324 pub fn repositories ( ) -> Array < Repository > {
2425 let mut count = 0 ;
25- let result =
26- unsafe { BNRepositoryManagerGetRepositories ( & mut count) } ;
26+ let result = unsafe { BNRepositoryManagerGetRepositories ( & mut count) } ;
2727 assert ! ( !result. is_null( ) ) ;
2828 unsafe { Array :: new ( result, count, ( ) ) }
2929 }
@@ -42,15 +42,12 @@ impl RepositoryManager {
4242 pub fn add_repository ( url : & str , repository_path : & Path ) -> bool {
4343 let url = url. to_cstr ( ) ;
4444 let repo_path = repository_path. to_cstr ( ) ;
45- unsafe {
46- BNRepositoryManagerAddRepository ( url. as_ptr ( ) , repo_path. as_ptr ( ) )
47- }
45+ unsafe { BNRepositoryManagerAddRepository ( url. as_ptr ( ) , repo_path. as_ptr ( ) ) }
4846 }
4947
5048 pub fn repository_by_path ( path : & Path ) -> Option < Repository > {
5149 let path = path. to_cstr ( ) ;
52- let result =
53- unsafe { BNRepositoryGetRepositoryByPath ( path. as_ptr ( ) ) } ;
50+ let result = unsafe { BNRepositoryGetRepositoryByPath ( path. as_ptr ( ) ) } ;
5451 NonNull :: new ( result) . map ( |raw| unsafe { Repository :: from_raw ( raw) } )
5552 }
5653
0 commit comments