Trait system_service::Application
[−]
[src]
pub trait Application: Sized { type Err: Send + 'static; type Config: Config; type Options: Options; fn new(_: Self::Options, _: Self::Config) -> Result<Self, Self::Err>; fn run_once(&mut self, context: &Context) -> Result<Stopping, Self::Err>; fn signals() -> &'static [Signal] { ... } fn received_signal(&mut self, _: Signal) { ... } fn shutdown(self) -> Result<(), Self::Err> { ... } }
The application; domain-specific program logic
Associated Types
type Err: Send + 'static
Main error export of the Application
type Config: Config
Config to be loaded from a file
type Options: Options
Options from the command line
Required Methods
fn new(_: Self::Options, _: Self::Config) -> Result<Self, Self::Err>
Create a new instance given the options and config
fn run_once(&mut self, context: &Context) -> Result<Stopping, Self::Err>
Called repeatedly in the main loop of the application.
Provided Methods
fn signals() -> &'static [Signal]
Which signal the application is interested in receiving.
By default, only INT and TERM are blocked and handled.
fn received_signal(&mut self, _: Signal)
Handle a received signal
fn shutdown(self) -> Result<(), Self::Err>
Called when the application is shutting down