Trait ProcessSpawner
pub trait ProcessSpawner:
Send
+ Sync
+ 'static {
// Required methods
fn start(
&self,
service: &ServiceDefinition,
) -> impl Future<Output = Result<()>> + Send;
fn stop(
&self,
service: &ServiceDefinition,
) -> impl Future<Output = Result<()>> + Send;
fn is_running(
&self,
service: &ServiceDefinition,
) -> impl Future<Output = Result<bool>> + Send;
}Expand description
Required Methods§
fn start(
&self,
service: &ServiceDefinition,
) -> impl Future<Output = Result<()>> + Send
fn start( &self, service: &ServiceDefinition, ) -> impl Future<Output = Result<()>> + Send
Starts the service as a stand-alone process.
The implementation should start the service and return immediately.
If the service has a exec_start_pre command, it should be executed
before starting the service.
The implementation may error if the service is already running.
fn stop(
&self,
service: &ServiceDefinition,
) -> impl Future<Output = Result<()>> + Send
fn stop( &self, service: &ServiceDefinition, ) -> impl Future<Output = Result<()>> + Send
Stops the process currently running the service.
The implementation should try to stop the service gracefully first, and
if that fails, it should try to kill the service. The
Service::shutdown_timeout should be respected for this.
The implementation may error if the service is not running.
fn is_running(
&self,
service: &ServiceDefinition,
) -> impl Future<Output = Result<bool>> + Send
fn is_running( &self, service: &ServiceDefinition, ) -> impl Future<Output = Result<bool>> + Send
Checks if the service is currently running.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.