pub trait FormatHandler: Send + Sync {
// Required methods
fn name(&self) -> &str;
fn can_handle(&self, file_path: &Path) -> bool;
fn extract<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
source_path: &'life1 Path,
target_dir: &'life2 Path,
progress: &'life3 ProgressContext,
) -> Pin<Box<dyn Future<Output = Result<Vec<PathBuf>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait;
// Provided methods
fn get_executable_name(&self, tool_name: &str) -> String { ... }
fn find_executables(
&self,
dir: &Path,
tool_name: &str,
) -> Result<Vec<PathBuf>> { ... }
fn is_executable(&self, path: &Path) -> bool { ... }
fn make_executable(&self, path: &Path) -> Result<()> { ... }
}Expand description
Trait for handling different archive formats and installation methods
Required Methods§
Sourcefn can_handle(&self, file_path: &Path) -> bool
fn can_handle(&self, file_path: &Path) -> bool
Check if this handler can process the given file
Sourcefn extract<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
source_path: &'life1 Path,
target_dir: &'life2 Path,
progress: &'life3 ProgressContext,
) -> Pin<Box<dyn Future<Output = Result<Vec<PathBuf>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn extract<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
source_path: &'life1 Path,
target_dir: &'life2 Path,
progress: &'life3 ProgressContext,
) -> Pin<Box<dyn Future<Output = Result<Vec<PathBuf>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Extract or install the file to the target directory
Provided Methods§
Sourcefn get_executable_name(&self, tool_name: &str) -> String
fn get_executable_name(&self, tool_name: &str) -> String
Get the expected executable name for a tool
Sourcefn find_executables(&self, dir: &Path, tool_name: &str) -> Result<Vec<PathBuf>>
fn find_executables(&self, dir: &Path, tool_name: &str) -> Result<Vec<PathBuf>>
Find executable files in the extracted directory
Sourcefn is_executable(&self, path: &Path) -> bool
fn is_executable(&self, path: &Path) -> bool
Check if a file is executable
Sourcefn make_executable(&self, path: &Path) -> Result<()>
fn make_executable(&self, path: &Path) -> Result<()>
Make a file executable on Unix systems