diff options
author | Radosław Kot <rdkt13@gmail.com> | 2021-06-26 15:31:45 +0200 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2021-06-26 17:31:24 +0200 |
commit | c708d44985805b31b60697643ca77fd64315330e (patch) | |
tree | 81d260a17f686dea50d962f32f695fdc95ecd093 /src/config.rs | |
parent | 48e4a66ab3dc30729c2212703d5b6992201a4028 (diff) |
Reimplement the Config building mechanism
This patch rewrites the Config building mechanism using special objects
for tracking the config building state.
Transitions between states are done on the fly as required.
This is required so that the async sources can be stored inside the
configuration building objects, while keeping out the expenses in the
non-async case, so a user of the crate has only to pay for what they are
using (no async means no overhead for that).
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Reviewed-by: Matthias Beyer <mail@beyermatthias.de>
Diffstat (limited to 'src/config.rs')
-rw-r--r-- | src/config.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/config.rs b/src/config.rs index 3d80aeb..b9c64b4 100644 --- a/src/config.rs +++ b/src/config.rs @@ -1,7 +1,7 @@ use std::collections::HashMap; use std::fmt::Debug; -use crate::builder::ConfigBuilder; +use crate::builder::{ConfigBuilder, DefaultState}; use serde::de::Deserialize; use serde::ser::Serialize; @@ -44,8 +44,8 @@ impl Config { } /// Creates new [`ConfigBuilder`] instance - pub fn builder() -> ConfigBuilder { - ConfigBuilder::default() + pub fn builder() -> ConfigBuilder<DefaultState> { + ConfigBuilder::<DefaultState>::default() } /// Merge in a configuration property source. |