From 834480a46c9c7b3b4b0e467b592ecc209e15b84c Mon Sep 17 00:00:00 2001 From: Ryan Leckey Date: Thu, 9 May 2019 09:58:48 -0700 Subject: Remove try_defaults_from and set_defaults (for now) as '#[serde(default)]' works thanks to #106 --- src/config.rs | 28 ---------------------------- 1 file changed, 28 deletions(-) (limited to 'src/config.rs') 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(&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(&mut self, key: &str, value: T) -> Result<&mut Config> where T: Into, @@ -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(from: &T) -> Result { - 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 { self.try_into() -- cgit v1.2.3