Expand description
A framework for writing system services
§About
Every application which runs as a service should implement things like logging, signal handling, graceful shutdown, CLI option parsing, and configuration file parsing. This package provides a semi-opinionated framework for doing so.
§Usage
There are several traits exported here including Application
, Config
,
Options
, and LogOptions
. The two options traits should be implemented
for your CLI option loadind, Config
for your config file loading, and
Application
for your application logic.
The primary run method is Application::run_once
which is called over and
over again in a loop. It is provided a Context
type which gives the
application control of when it checks for signals. Any received signals are
passed to Application::received_signal
for handling.
Once Application::run_once
returns Stopping::Yes
, the main loop
terminates and invokes Application::shutdown
before exitting.
Macros§
- die
- Print a message to stderr and exit(1)
Structs§
- Context
- A context passed to
Application::run_once
Enums§
- Stopping
- Indicates whether the run loop should halt
Traits§
- Application
- The application; domain-specific program logic
- Config
- Trait required for loading Config from file
- LogOptions
- Additional requirents for CLI options to initialize the logging subsystem
- Options
- Trait required for loading CLI options
Functions§
- run
- Run an Application