Expand description
§converge
This crate facilitates defaulting values in a similar way to Option’s or method but for each field in a structure. The traits defined in this crate can be derived using converge_derive. Both converge and converge_derive where created to separate order of precedence from configuration content.
§Motivation
Both the Unix philosophy and the idea of micro services lead to writing lots of applications with configuration boiler plate code.
It is reasonable to expect these applications will take configuration from the command line arguments, environment and one or more configuration files. It is also expected that the more specific configuration files will override the more general. The environment configuration overrides the configuration files, and the command line arguments overrides the environment and file based configuration. Also the command line and environment configuration, may specify the location of a configuration file, that overrides all the other configuration files.
As applications mature the number of configuration options also tends to grow adding to the complexity. Testing of configuration overriding for each configuration option further increases the quantity of boiler plate code.
This crate keeps the configuration override precedence separate from configuration content reducing the quantity and complexity of the code base, and with it the amount of testing needed.
use converge::Converge;
#[derive(Converge)]
struct Simple {
number: Option<i32>,
}Modules§
- strategies
- A collection of common strategies that might be of use for field types.
Traits§
- Converge
- The Converge Trait.
Derive Macros§
- Converge
- Simple macro to derive the Converge trait.