static OUTSIDE_SECTION: &str = "[";
static SPECIAL_SERVER_SECTION: &str = "SERVER";
-#[derive(Default,Debug)]
+#[derive(Debug)]
struct Aggregate {
keys_allowed: HashMap<&'static str, SectionKindList>,
sections: HashMap<SectionName, SectionMap>,
}
impl Aggregate {
+ fn new(
+ keys_allowed: HashMap<&'static str, SectionKindList>
+ ) -> Self { Aggregate {
+ keys_allowed,
+ sections: default(),
+ } }
+
#[throws(AE)] // AE does not include path
fn read_file<A>(&mut self, path: &Path, anyway: OkAnyway<A>) -> Option<A>
{
#[throws(AE)]
pub fn read(opts: &Opts, end: LinkEnd) -> Vec<InstanceConfig> {
let agg = (||{
- let mut agg = Aggregate::default();
- agg.keys_allowed.extend(
- InstanceConfig::FIELDS.iter().cloned()
+ let mut agg = Aggregate::new(
+ InstanceConfig::FIELDS.iter().cloned().collect(),
);
agg.read_string(DEFAULT_CONFIG.into(),