Trait PackageManager

Source
pub trait PackageManager: Send + Sync {
    // Required methods
    fn name(&self) -> &str;
    fn ecosystem(&self) -> Ecosystem;
    fn install_packages<'life0, 'life1, 'async_trait>(
        &'life0 self,
        packages: &'life1 [PackageSpec],
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn remove_packages<'life0, 'life1, 'async_trait>(
        &'life0 self,
        packages: &'life1 [String],
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn list_packages<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<PackageInfo>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn search_packages<'life0, 'life1, 'async_trait>(
        &'life0 self,
        query: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<PackageInfo>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn update_packages<'life0, 'life1, 'async_trait>(
        &'life0 self,
        packages: &'life1 [String],
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn is_available<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn is_preferred_for_project(&self, project_path: &Path) -> bool;
    fn get_config(&self) -> PackageManagerConfig;
    fn run_command<'life0, 'life1, 'async_trait>(
        &'life0 self,
        args: &'life1 [String],
    ) -> Pin<Box<dyn Future<Output = Result<i32>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Trait for package managers

Required Methods§

Source

fn name(&self) -> &str

Get the name of this package manager

Source

fn ecosystem(&self) -> Ecosystem

Get the ecosystem this package manager belongs to

Source

fn install_packages<'life0, 'life1, 'async_trait>( &'life0 self, packages: &'life1 [PackageSpec], ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Install packages

Source

fn remove_packages<'life0, 'life1, 'async_trait>( &'life0 self, packages: &'life1 [String], ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Remove packages

Source

fn list_packages<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<PackageInfo>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

List installed packages

Source

fn search_packages<'life0, 'life1, 'async_trait>( &'life0 self, query: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<PackageInfo>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Search for packages

Source

fn update_packages<'life0, 'life1, 'async_trait>( &'life0 self, packages: &'life1 [String], ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Update packages

Source

fn is_available<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Check if this package manager is available on the system

Source

fn is_preferred_for_project(&self, project_path: &Path) -> bool

Check if this package manager is preferred for the given project

Source

fn get_config(&self) -> PackageManagerConfig

Get package manager configuration

Source

fn run_command<'life0, 'life1, 'async_trait>( &'life0 self, args: &'life1 [String], ) -> Pin<Box<dyn Future<Output = Result<i32>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Run a package manager command

Implementors§