pub struct Config {
pub units: UnitSet,
pub targets: TargetSet,
pub log: LogConfig,
pub http: Server,
}
Expand description
The complete RTRTR configuration.
All configuration is available via public fields.
The associated function init
should be called first thing
as it initializes the operational environment such as logging. Thereafter,
config_args
can be used to configure a clap app to
be able to pick up the path to the configuration file.
from_arg_matches
will then load the file
referenced in the command line and, upon success, return the config.
Fields
units: UnitSet
The set of configured units.
targets: TargetSet
The set of configured targets.
log: LogConfig
The logging configuration.
http: Server
The HTTP server configuration.
Implementations
Initialises everything.
This function should be called first thing.
Creates a configuration from a bytes slice with TOML data.
Configures a clap app with the arguments to load the configuration.
pub fn from_arg_matches(
matches: &ArgMatches,
cur_dir: &Path,
manager: &mut Manager
) -> Result<Self, Failed>
pub fn from_arg_matches(
matches: &ArgMatches,
cur_dir: &Path,
manager: &mut Manager
) -> Result<Self, Failed>
Loads the configuration based on command line options provided.
The matches
must be the result of getting argument matches from a
clap app previously configured with
config_args
. Otherwise, the function is likely
to panic.
The current path needs to be provided to be able to deal with relative paths. The manager is necessary to resolve links given in the configuration.
Trait Implementations
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations
impl !RefUnwindSafe for Config
impl !UnwindSafe for Config
Blanket Implementations
Mutably borrows from an owned value. Read more
pub fn vzip(self) -> V
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more