Skip to main content

Machine

Trait Machine 

Source
pub trait Machine {
    // Required methods
    fn installed(&self, program: &str) -> bool;
    fn docker_running(&self) -> bool;
    fn os(&self) -> String;
    fn run(
        &self,
        program: &str,
        args: &[&str],
        dir: &Path,
    ) -> Result<(), String>;
    fn output(
        &self,
        program: &str,
        args: &[&str],
        dir: &Path,
        variables: &[(String, String)],
    ) -> Result<String, String>;
}
Expand description

What the CLI needs to know about, or do on, the machine.

Required Methods§

Source

fn installed(&self, program: &str) -> bool

Whether a program answers --version.

Source

fn docker_running(&self) -> bool

Whether the Docker daemon answers.

Source

fn os(&self) -> String

The operating system, as prompts name it: macOS, Windows, Ubuntu 24.04.

Source

fn run(&self, program: &str, args: &[&str], dir: &Path) -> Result<(), String>

Runs a program in dir, its output hidden; Err holds what it printed on error.

Source

fn output( &self, program: &str, args: &[&str], dir: &Path, variables: &[(String, String)], ) -> Result<String, String>

Runs a program in dir with more environment variables, and returns what it printed.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§