From c26a941541ccd7733f7533372da71f0a5be36ed5 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Sun, 14 Mar 2021 09:26:51 +0100 Subject: Rename try_into/try_from Because of the clash in names with the TryInto and TryFrom traits, we're renaming the functions here to try_serialize/try_deserialize. Signed-off-by: Matthias Beyer --- src/config.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/config.rs') diff --git a/src/config.rs b/src/config.rs index 1019061..99216ad 100644 --- a/src/config.rs +++ b/src/config.rs @@ -227,20 +227,20 @@ impl Config { } /// Attempt to deserialize the entire configuration into the requested type. - pub fn try_into<'de, T: Deserialize<'de>>(self) -> Result { + pub fn try_deserialize<'de, T: Deserialize<'de>>(self) -> Result { T::deserialize(self) } /// Attempt to serialize the entire configuration from the given type. - pub fn try_from(from: &T) -> Result { + pub fn try_serialize(from: &T) -> Result { let mut serializer = ConfigSerializer::default(); from.serialize(&mut serializer)?; Ok(serializer.output) } - #[deprecated(since = "0.7.0", note = "please use 'try_into' instead")] + #[deprecated(since = "0.7.0", note = "please use 'try_deserialize' instead")] pub fn deserialize<'de, T: Deserialize<'de>>(self) -> Result { - self.try_into() + self.try_deserialize() } } -- cgit v1.2.3