@@ -11,21 +11,16 @@ use std::ptr::NonNull;
1111
1212/// Keeps track of all the repositories and keeps the `enabled_plugins.json`
1313/// file coherent with the plugins that are installed/uninstalled enabled/disabled
14- pub struct RepositoryManager {
15- }
14+ pub struct RepositoryManager ;
1615
1716impl RepositoryManager {
18- pub fn new ( ) -> Self {
19- Self { }
20- }
21-
2217 /// Check for updates for all managed [`Repository`] objects
23- pub fn check_for_updates ( & self ) -> bool {
18+ pub fn check_for_updates ( ) -> bool {
2419 unsafe { BNRepositoryManagerCheckForUpdates ( ) }
2520 }
2621
2722 /// List of [`Repository`] objects being managed
28- pub fn repositories ( & self ) -> Array < Repository > {
23+ pub fn repositories ( ) -> Array < Repository > {
2924 let mut count = 0 ;
3025 let result =
3126 unsafe { BNRepositoryManagerGetRepositories ( & mut count) } ;
@@ -44,23 +39,23 @@ impl RepositoryManager {
4439 /// * `repository_path` - path to where the repository will be stored on disk locally
4540 ///
4641 /// Returns true if the repository was successfully added, false otherwise.
47- pub fn add_repository ( & self , url : & str , repository_path : & Path ) -> bool {
42+ pub fn add_repository ( url : & str , repository_path : & Path ) -> bool {
4843 let url = url. to_cstr ( ) ;
4944 let repo_path = repository_path. to_cstr ( ) ;
5045 unsafe {
5146 BNRepositoryManagerAddRepository ( url. as_ptr ( ) , repo_path. as_ptr ( ) )
5247 }
5348 }
5449
55- pub fn repository_by_path ( & self , path : & Path ) -> Option < Repository > {
50+ pub fn repository_by_path ( path : & Path ) -> Option < Repository > {
5651 let path = path. to_cstr ( ) ;
5752 let result =
5853 unsafe { BNRepositoryGetRepositoryByPath ( path. as_ptr ( ) ) } ;
5954 NonNull :: new ( result) . map ( |raw| unsafe { Repository :: from_raw ( raw) } )
6055 }
6156
6257 /// Gets the default [`Repository`]
63- pub fn default_repository ( & self ) -> Ref < Repository > {
58+ pub fn default_repository ( ) -> Ref < Repository > {
6459 let result = unsafe { BNRepositoryManagerGetDefaultRepository ( ) } ;
6560 assert ! ( !result. is_null( ) ) ;
6661 unsafe { Repository :: ref_from_raw ( NonNull :: new ( result) . unwrap ( ) ) }
@@ -70,7 +65,7 @@ impl RepositoryManager {
7065impl Debug for RepositoryManager {
7166 fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
7267 f. debug_struct ( "RepositoryManager" )
73- . field ( "repositories" , & self . repositories ( ) . to_vec ( ) )
68+ . field ( "repositories" , & RepositoryManager :: repositories ( ) . to_vec ( ) )
7469 . finish ( )
7570 }
7671}
0 commit comments