Struct StandardPackageManager

Source
pub struct StandardPackageManager { /* private fields */ }
Expand description

Standard package manager implementation

This is a convenience implementation for package managers that follow common patterns. It provides sensible defaults and can be customized through configuration.

Implementations§

Source§

impl StandardPackageManager

Source

pub fn new( name: impl Into<String>, description: impl Into<String>, ecosystem: Ecosystem, ) -> Self

Create a new standard package manager

Source

pub fn with_config_file(self, config_file: impl Into<String>) -> Self

Add a configuration file that indicates this package manager should be used

Source

pub fn with_install_command(self, command: Vec<String>) -> Self

Set custom install command

Source

pub fn with_remove_command(self, command: Vec<String>) -> Self

Set custom remove command

Source

pub fn with_update_command(self, command: Vec<String>) -> Self

Set custom update command

Trait Implementations§

Source§

impl VxPackageManager for StandardPackageManager

Source§

fn name(&self) -> &str

Package manager name (required) Read more
Source§

fn ecosystem(&self) -> Ecosystem

Ecosystem this package manager belongs to (required) Read more
Source§

fn description(&self) -> &str

Description of the package manager (optional) Read more
Source§

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

Get configuration files that indicate this package manager should be used Read more
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) Read more
Source§

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

Get the command to install packages Read more
Source§

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

Get the command to remove packages Read more
Source§

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

Get the command to update packages Read more
Source§

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

Get the command to list packages Read more
Source§

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

Get the command to search packages Read more
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 Read more
Source§

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

Check if this package manager should be used for a project Read more
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 Read more
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 Read more
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 Read more
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 Read more
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 Read more
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 Read more
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 Read more
Source§

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

Get the command to add new packages Read more
Source§

fn get_config(&self) -> PackageManagerConfig

Get package manager configuration Read more
Source§

fn run_command_with_code<'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<i32>> + 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 and return the exit code Read more
Source§

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

Additional metadata for the package manager (optional) Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.