pub trait HostProbe: Send + Sync {
// Required methods
fn path_dirs(&self) -> Vec<PathBuf>;
fn manager_prefixes(&self) -> Vec<(ToolSource, PathBuf)>;
fn resolve(&self, dir: &Path, name: &str) -> Option<PathBuf>;
fn canonicalize(&self, path: &Path) -> PathBuf;
fn version<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 Path,
) -> Pin<Box<dyn Future<Output = Option<String>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}Expand description
Filesystem + process abstraction the scanner talks to.
Splitting this out lets unit tests supply a virtual PATH/prefix set and fixture binaries without touching the real filesystem or spawning processes.
Required Methods§
Sourcefn path_dirs(&self) -> Vec<PathBuf>
fn path_dirs(&self) -> Vec<PathBuf>
PATH directories, in order (already split on the OS separator).
Sourcefn manager_prefixes(&self) -> Vec<(ToolSource, PathBuf)>
fn manager_prefixes(&self) -> Vec<(ToolSource, PathBuf)>
Known package-manager install roots as (source, prefix) pairs.
Prefixes are canonical (real install roots, not symlinks).
Sourcefn resolve(&self, dir: &Path, name: &str) -> Option<PathBuf>
fn resolve(&self, dir: &Path, name: &str) -> Option<PathBuf>
Resolve name inside dir to an existing executable path.
On Windows this applies PATHEXT (.exe, .cmd, …). None if absent.
Sourcefn canonicalize(&self, path: &Path) -> PathBuf
fn canonicalize(&self, path: &Path) -> PathBuf
Canonicalize a path (follow symlinks). Falls back to path itself on
error — canonicalize fails for non-existent paths, but we only call it
after a successful resolve.
Sourcefn version<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 Path,
) -> Pin<Box<dyn Future<Output = Option<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn version<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 Path,
) -> Pin<Box<dyn Future<Output = Option<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Probe the version of an executable. Runs <path> --version with a short
timeout and returns the first non-empty line, trimmed. None on failure.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".