Skip to main content

ControlFactory

Trait ControlFactory 

Source
pub trait ControlFactory:
    Debug
    + Send
    + Sync {
    // Required method
    fn control(
        &self,
        mode: StartMode,
    ) -> Result<Box<dyn ServiceControl>, ServiceError>;
}
Expand description

Chooses the control for a start mode.

The indirection is what makes ServiceOperations testable: production hands it HostControls, every test in this file hands it RecordingControls, and neither knows the difference.

Required Methods§

Source

fn control( &self, mode: StartMode, ) -> Result<Box<dyn ServiceControl>, ServiceError>

The control for one start-mode domain.

§Errors

ServiceError::Control when this host has no manager for that domain.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§