Skip to main content

ProbeHost

Trait ProbeHost 

Source
pub trait ProbeHost {
    // Required methods
    fn os(&self) -> String;
    fn arch(&self) -> String;
    fn which(&self, tool: &str) -> Option<PathBuf>;
    fn run(&self, tool: &str, args: &[&str]) -> Option<String>;
    fn run_all(&self, tool: &str, args: &[&str]) -> Option<String>;
    fn read_file(&self, path: &str) -> Option<String>;
    fn list_dir(&self, path: &str) -> Option<Vec<String>>;
    fn exists(&self, path: &str) -> bool;
}
Expand description

What probes may ask of the machine.

Required Methods§

Source

fn os(&self) -> String

std::env::consts::OS of the probed machine (macos, linux).

Source

fn arch(&self) -> String

std::env::consts::ARCH of the probed machine (aarch64, arm).

Source

fn which(&self, tool: &str) -> Option<PathBuf>

Resolve a tool name to an executable path, if installed.

Source

fn run(&self, tool: &str, args: &[&str]) -> Option<String>

Run a tool (resolved with Self::which) and return stdout when it exits 0 within the timeout.

Source

fn run_all(&self, tool: &str, args: &[&str]) -> Option<String>

Like Self::run but returns stdout followed by stderr (for tools that print their version on stderr, such as llama-server).

Source

fn read_file(&self, path: &str) -> Option<String>

Read a small text file.

Source

fn list_dir(&self, path: &str) -> Option<Vec<String>>

List directory entry names.

Source

fn exists(&self, path: &str) -> bool

True if the path exists.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§