Skip to main content

ServiceOps

Trait ServiceOps 

Source
pub trait ServiceOps {
    // Required methods
    fn unit_dir(&self) -> Result<PathBuf>;
    fn binary_path(&self) -> Result<PathBuf>;

    // Provided methods
    fn activate(&self, _unit_path: &Path) -> bool { ... }
    fn deactivate(&self, _unit_path: &Path) { ... }
}
Expand description

Abstraction over the side-effecting parts of install/uninstall so the install logic itself is fully unit-testable.

Required Methods§

Provided Methods§

Source

fn activate(&self, _unit_path: &Path) -> bool

Activate the unit (systemctl –user enable / launchctl load / schtasks /Create). Implementations return false if the platform tool isn’t available so install() can still succeed (file written, manual activation instructions printed).

Source

fn deactivate(&self, _unit_path: &Path)

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§