Trait Tool

Source
pub trait Tool: Send + Sync {
    // Required methods
    fn name(&self) -> &str;
    fn is_installed(&self) -> Result<bool>;
    fn get_version(&self) -> Result<Option<String>>;
    fn get_executable_path(&self, version: &str, install_dir: &Path) -> PathBuf;
    fn execute(&self, args: &[String]) -> Result<i32>;

    // Provided methods
    fn description(&self) -> &str { ... }
    fn homepage(&self) -> Option<&str> { ... }
    fn supports_auto_install(&self) -> bool { ... }
    fn get_info(&self) -> ToolInfo { ... }
}
Expand description

Synchronous tool interface for compatibility with legacy code This trait provides a synchronous interface for tools that don’t need async operations

Required Methods§

Source

fn name(&self) -> &str

Get the tool name

Source

fn is_installed(&self) -> Result<bool>

Check if the tool is installed on the system

Source

fn get_version(&self) -> Result<Option<String>>

Get the currently installed version (if any)

Source

fn get_executable_path(&self, version: &str, install_dir: &Path) -> PathBuf

Get the expected executable path for a given version

Source

fn execute(&self, args: &[String]) -> Result<i32>

Execute the tool with given arguments

Provided Methods§

Source

fn description(&self) -> &str

Get tool description

Source

fn homepage(&self) -> Option<&str>

Get tool homepage URL

Source

fn supports_auto_install(&self) -> bool

Check if tool supports auto-installation

Source

fn get_info(&self) -> ToolInfo

Get tool information

Implementors§