Skip to main content

Service

Trait Service 

Source
pub trait Service {
    // Required methods
    fn name(&self) -> &str;
    fn description(&self) -> &str;
    fn label(&self) -> &str;

    // Provided methods
    fn start(&self, force: bool) -> Result<()> { ... }
    fn stop(&self) -> Result<()> { ... }
    fn logs(&self, tail_args: &[String]) -> Result<()> { ... }
}
Expand description

Trait for external command binaries that run as system services.

Implementors provide metadata; start/stop/logs come free.

Required Methods§

Source

fn name(&self) -> &str

Service name, e.g. “search”. Used for log/port files.

Source

fn description(&self) -> &str

Human description.

Source

fn label(&self) -> &str

Reverse-DNS label, e.g. “ai.crabtalk.search”.

Provided Methods§

Source

fn start(&self, force: bool) -> Result<()>

Install and start the service.

If the service is already installed, prints a message and returns unless force is set, in which case it re-installs.

Source

fn stop(&self) -> Result<()>

Stop and uninstall the service.

Source

fn logs(&self, tail_args: &[String]) -> Result<()>

View service logs.

Implementors§