pub trait PackageHandler {
// Required methods
fn install(&self, source: &str, local: bool) -> Result<(), String>;
fn remove(&self, source: &str, local: bool) -> Result<bool, String>;
fn list(&self) -> Result<Vec<ListedPackage>, String>;
fn is_project_trusted(&self) -> bool;
fn refresh_models(&self) -> Result<(), String>;
fn update_extensions(&self, source: Option<&str>) -> Result<(), String>;
fn update_self(&self, force: bool) -> Result<bool, String>;
// Provided methods
fn set_offline(&self, _offline: bool) { ... }
fn set_project_trust_override(&self, _trust_override: Option<bool>) { ... }
}Expand description
Side-effect surface injected by the caller.
Each method maps to one subcommand operation. Implementations may run real
subprocesses (core::package_manager::PackageManager) or fake the work in
tests. Strings returned by Err are surfaced verbatim prefixed with
Error: .
Required Methods§
Sourcefn install(&self, source: &str, local: bool) -> Result<(), String>
fn install(&self, source: &str, local: bool) -> Result<(), String>
Install source in the requested scope.
§Errors
Implementation-defined; the error string is shown verbatim.
Sourcefn is_project_trusted(&self) -> bool
fn is_project_trusted(&self) -> bool
Whether the project is currently trusted (for the local-write gate).
Sourcefn refresh_models(&self) -> Result<(), String>
fn refresh_models(&self) -> Result<(), String>
Provided Methods§
Sourcefn set_offline(&self, _offline: bool)
fn set_offline(&self, _offline: bool)
Apply invocation-scoped offline mode before package-command dispatch.
Sourcefn set_project_trust_override(&self, _trust_override: Option<bool>)
fn set_project_trust_override(&self, _trust_override: Option<bool>)
Supply the invocation-scoped project trust override before preflight.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".