pub struct ServiceHandle { /* private fields */ }
Expand description
Represents a handle to a Windows service.
Implementations§
Source§impl ServiceHandle
impl ServiceHandle
Sourcepub fn state(&self) -> Result<ServiceState, QueryServiceError>
pub fn state(&self) -> Result<ServiceState, QueryServiceError>
Returns the current state of this ServiceHandle
.
§Errors
This function will return an error if it can’t retrieve the service status.
Sourcepub fn update_config(
&self,
options: ServiceConfig,
) -> Result<(), UpdateServiceError>
pub fn update_config( &self, options: ServiceConfig, ) -> Result<(), UpdateServiceError>
Updates the configuration of the service.
§Errors
This function will return an error if it can’t update the service configuration.
Sourcepub fn get_start_type(&self) -> Result<ServiceStartType, QueryServiceError>
pub fn get_start_type(&self) -> Result<ServiceStartType, QueryServiceError>
Returns the get start type of this ServiceHandle
.
§Errors
This function will return an error if it can’t get the start type.
Sourcepub fn set_start_type(
&self,
start_type: ServiceStartType,
) -> Result<(), UpdateServiceError>
pub fn set_start_type( &self, start_type: ServiceStartType, ) -> Result<(), UpdateServiceError>
Sets the start type of the service.
§Errors
This function will return an error if it can’t set the start type.
pub fn delete(&self) -> Result<(), DeleteServiceError>
Sourcepub fn start_blocking(&self) -> Result<(), ControlServiceError>
pub fn start_blocking(&self) -> Result<(), ControlServiceError>
Starts the service and blocks until it is running.
§Errors
This function will return an error if it can’t start the service.
Sourcepub fn stop_blocking(&self) -> Result<(), ControlServiceError>
pub fn stop_blocking(&self) -> Result<(), ControlServiceError>
Stops the service and blocks until it is stopped.
§Errors
This function will return an error if it can’t stop the service.
Sourcepub fn pause_blocking(&self) -> Result<(), ControlServiceError>
pub fn pause_blocking(&self) -> Result<(), ControlServiceError>
Pauses the service and blocks until it is paused.
§Errors
This function will return an error if it can’t pause the service.