pub trait VxPackageManager: Send + Sync {
Show 17 methods
// Required methods
fn name(&self) -> &str;
fn ecosystem(&self) -> Ecosystem;
fn install_packages<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
packages: &'life1 [PackageSpec],
project_path: &'life2 Path,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
// Provided methods
fn description(&self) -> &str { ... }
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_files(&self) -> Vec<&str> { ... }
fn remove_packages<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
packages: &'life1 [String],
project_path: &'life2 Path,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
fn update_packages<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
packages: &'life1 [String],
project_path: &'life2 Path,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
fn list_packages<'life0, 'life1, 'async_trait>(
&'life0 self,
project_path: &'life1 Path,
) -> Pin<Box<dyn Future<Output = Result<Vec<PackageInfo>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: '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 run_command<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
command: &'life1 [&'life2 str],
args: &'life3 [String],
project_path: &'life4 Path,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait { ... }
fn default_list_packages<'life0, 'life1, 'async_trait>(
&'life0 self,
_project_path: &'life1 Path,
) -> Pin<Box<dyn Future<Output = Result<Vec<PackageInfo>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn run_search_command<'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 get_install_command(&self) -> Vec<&str> { ... }
fn get_add_command(&self) -> Vec<&str> { ... }
fn metadata(&self) -> HashMap<String, String> { ... }
}Expand description
Simplified trait for implementing package manager support
This trait provides a high-level interface for package managers, with sensible defaults for common operations.
Required Methods§
Sourcefn install_packages<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
packages: &'life1 [PackageSpec],
project_path: &'life2 Path,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn install_packages<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
packages: &'life1 [PackageSpec],
project_path: &'life2 Path,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Install packages (main method to implement)
Provided Methods§
Sourcefn description(&self) -> &str
fn description(&self) -> &str
Description of the package manager (optional)
Sourcefn 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_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
Sourcefn is_preferred_for_project(&self, project_path: &Path) -> bool
fn is_preferred_for_project(&self, project_path: &Path) -> bool
Check if this package manager should be used for a project Override this to detect project-specific files (package.json, Cargo.toml, etc.)
Sourcefn get_config_files(&self) -> Vec<&str>
fn get_config_files(&self) -> Vec<&str>
Get configuration files that indicate this package manager should be used
Sourcefn remove_packages<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
packages: &'life1 [String],
project_path: &'life2 Path,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn remove_packages<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
packages: &'life1 [String],
project_path: &'life2 Path,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Remove packages (has default implementation)
Sourcefn update_packages<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
packages: &'life1 [String],
project_path: &'life2 Path,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn update_packages<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
packages: &'life1 [String],
project_path: &'life2 Path,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Update packages (has default implementation)
Sourcefn list_packages<'life0, 'life1, 'async_trait>(
&'life0 self,
project_path: &'life1 Path,
) -> Pin<Box<dyn Future<Output = Result<Vec<PackageInfo>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn list_packages<'life0, 'life1, 'async_trait>(
&'life0 self,
project_path: &'life1 Path,
) -> Pin<Box<dyn Future<Output = Result<Vec<PackageInfo>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
List installed packages (has default implementation)
Sourcefn 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 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 (has default implementation)
Sourcefn run_command<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
command: &'life1 [&'life2 str],
args: &'life3 [String],
project_path: &'life4 Path,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
fn run_command<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
command: &'life1 [&'life2 str],
args: &'life3 [String],
project_path: &'life4 Path,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
Run a package manager command with arguments
Sourcefn default_list_packages<'life0, 'life1, 'async_trait>(
&'life0 self,
_project_path: &'life1 Path,
) -> Pin<Box<dyn Future<Output = Result<Vec<PackageInfo>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn default_list_packages<'life0, 'life1, 'async_trait>(
&'life0 self,
_project_path: &'life1 Path,
) -> Pin<Box<dyn Future<Output = Result<Vec<PackageInfo>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Default implementation for listing packages
Sourcefn run_search_command<'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 run_search_command<'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,
Default implementation for searching packages
Sourcefn get_install_command(&self) -> Vec<&str>
fn get_install_command(&self) -> Vec<&str>
Get the command to install packages (override for custom install commands)
Sourcefn get_add_command(&self) -> Vec<&str>
fn get_add_command(&self) -> Vec<&str>
Get the command to add new packages (override if different from install)