pub trait PackageManager: Send + Sync {
// Required methods
fn name(&self) -> &'static str;
fn is_available(&self) -> bool;
fn is_installed(
&self,
runner: &dyn Runner,
pkg: &str,
) -> Result<bool, PackageError>;
fn install(
&self,
runner: &dyn Runner,
packages: &[String],
) -> Result<(), PackageError>;
}Expand description
Abstraction over a system package manager.
Required Methods§
Sourcefn name(&self) -> &'static str
fn name(&self) -> &'static str
Stable lowercase identifier (e.g. "pacman", "apt").
This matches the field name in DepsGroup in the config schema.
Sourcefn is_available(&self) -> bool
fn is_available(&self) -> bool
Returns true when the manager’s binary is on PATH.
Sourcefn is_installed(
&self,
runner: &dyn Runner,
pkg: &str,
) -> Result<bool, PackageError>
fn is_installed( &self, runner: &dyn Runner, pkg: &str, ) -> Result<bool, PackageError>
Returns true when pkg is already installed.
Only errors on unexpected conditions — a clean “not installed” (exit 1
from a query command) is returned as Ok(false).