pub trait PackageManager: Send + Sync {
    // Required methods
    fn name(&self) -> String;
    fn install(
        &self,
        context: &Context,
        package: &InstallationEntry
    ) -> Result<Option<String>>;
    fn uninstall(
        &self,
        context: &Context,
        package: &InstallationEntry
    ) -> Result<()>;
    fn get_all_explicit(
        &self,
        context: &Context
    ) -> Result<Vec<(String, String)>>;
}

Required Methods§

source

fn name(&self) -> String

source

fn install( &self, context: &Context, package: &InstallationEntry ) -> Result<Option<String>>

Installs a package with the given version. If no version is supplied, this should install the latest version. Note that this does not affect the cache file. This simply supplies the system package install command.

§Parameters
  • package - The name of the package to install.
  • version - The version of the package to install. If None, the latest version should be installed.
§Returns

The version of the package installed, if none was specified in the input. Otherwise, None, or an error if the package could not be installed.

source

fn uninstall( &self, context: &Context, package: &InstallationEntry ) -> Result<()>

Uninstalls a package from the system. This does not affect the cache file, it simply removes the package from the system itself, and darling-core will handle removing the package from the cache file.

§Parameters
  • package - The name of the package to remove.
§Returns

An error if the package could not be removed.

source

fn get_all_explicit(&self, context: &Context) -> Result<Vec<(String, String)>>

Returns all explicitly installed packages on the system; That is, packages which are not dependencies of other packages. This should not read from a darling file; Instead, darling uses this method to update the file when running darling require-all

§Returns

The name and version of each installed package. as a Vec<(name: String, version: String)>.

Implementors§