From 37403d00d2dcd8c5ceca4ab7f40ef704c6df32d8 Mon Sep 17 00:00:00 2001 From: tyranron Date: Mon, 8 Apr 2019 15:33:14 +0300 Subject: Fix annoying 'invalid type: unit value, expected struct Settings' error --- src/config.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/config.rs') diff --git a/src/config.rs b/src/config.rs index 893baea..03d2453 100644 --- a/src/config.rs +++ b/src/config.rs @@ -10,7 +10,7 @@ use ser::ConfigSerializer; use source::Source; use path; -use value::{Value, ValueKind, ValueWithKey}; +use value::{Table, Value, ValueKind, ValueWithKey}; #[derive(Clone, Debug)] enum ConfigKind { @@ -49,7 +49,12 @@ pub struct Config { impl Config { pub fn new() -> Self { - Config::default() + Self { + kind: ConfigKind::default(), + // Config root should be instantiated as an empty table + // to avoid deserialization errors. + cache: Value::new(None, Table::new()), + } } /// Merge in a configuration property source. -- cgit v1.2.3