pub trait ServiceManager {
    fn available(&self) -> Result<bool>;
    fn install(&self, ctx: ServiceInstallCtx) -> Result<()>;
    fn uninstall(&self, ctx: ServiceUninstallCtx) -> Result<()>;
    fn start(&self, ctx: ServiceStartCtx) -> Result<()>;
    fn stop(&self, ctx: ServiceStopCtx) -> Result<()>;
    fn level(&self) -> ServiceLevel;
    fn set_level(&mut self, level: ServiceLevel) -> Result<()>;
}
Expand description

Interface for a service manager

Required Methods

Determines if the service manager exists (e.g. is launchd available on the system?) and can be used

Installs a new service using the manager

Uninstalls an existing service using the manager

Starts a service using the manager

Stops a running service using the manager

Returns the current target level for the manager

Sets the target level for the manager

Implementations

Creates a new service using the specified type, falling back to selecting based on native service manager for the current operating system if no type provided

Creates a new service manager targeting the specific service manager kind using the default service manager instance

Attempts to select a native service manager for the current operating system

Trait Implementations

Converts to this type from the input type.

Implementors