Trait VxPackageManager

Source
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§

Source

fn name(&self) -> &str

Package manager name (required)

Source

fn ecosystem(&self) -> Ecosystem

Ecosystem this package manager belongs to (required)

Source

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§

Source

fn description(&self) -> &str

Description of the package manager (optional)

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 should be used for a project Override this to detect project-specific files (package.json, Cargo.toml, etc.)

Source

fn get_config_files(&self) -> Vec<&str>

Get configuration files that indicate this package manager should be used

Source

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)

Source

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)

Source

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)

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 (has default implementation)

Source

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

Source

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

Source

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

Source

fn get_install_command(&self) -> Vec<&str>

Get the command to install packages (override for custom install commands)

Source

fn get_add_command(&self) -> Vec<&str>

Get the command to add new packages (override if different from install)

Source

fn metadata(&self) -> HashMap<String, String>

Additional metadata for the package manager (optional)

Implementors§