diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/config.rs | 28 |
1 files changed, 0 insertions, 28 deletions
diff --git a/src/config.rs b/src/config.rs index fa43e2a..2ce73f1 100644 --- a/src/config.rs +++ b/src/config.rs @@ -134,26 +134,6 @@ impl Config { self.refresh() } - /// Set the configuration defaults by serializing them from given value. - pub fn set_defaults<T>(&mut self, value: &T) -> Result<&mut Config> - where - T: Serialize, - { - match self.kind { - ConfigKind::Mutable { - ref mut defaults, .. - } => { - for (key, val) in Self::try_from(&value)?.collect()? { - defaults.insert(key.parse()?, val); - } - } - - ConfigKind::Frozen => return Err(ConfigError::Frozen), - } - - self.refresh() - } - pub fn set<T>(&mut self, key: &str, value: T) -> Result<&mut Config> where T: Into<Value>, @@ -224,14 +204,6 @@ impl Config { Ok(serializer.output) } - /// Attempt to serialize the entire configuration from the given type - /// as default values. - pub fn try_defaults_from<T: Serialize>(from: &T) -> Result<Self> { - let mut c = Self::new(); - c.set_defaults(from)?; - Ok(c) - } - #[deprecated(since = "0.7.0", note = "please use 'try_into' instead")] pub fn deserialize<'de, T: Deserialize<'de>>(self) -> Result<T> { self.try_into() |