diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2021-03-14 09:26:51 +0100 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2021-03-14 09:48:59 +0100 |
commit | c26a941541ccd7733f7533372da71f0a5be36ed5 (patch) | |
tree | 2ed0a5f2df07dd3dcdbf73af9394cdea5f9df57a /src/config.rs | |
parent | a3f205dc628b59a32de813b3efefbaec4667d217 (diff) |
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 <mail@beyermatthias.de>
Diffstat (limited to 'src/config.rs')
-rw-r--r-- | src/config.rs | 8 |
1 files changed, 4 insertions, 4 deletions
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<T> { + pub fn try_deserialize<'de, T: Deserialize<'de>>(self) -> Result<T> { T::deserialize(self) } /// Attempt to serialize the entire configuration from the given type. - pub fn try_from<T: Serialize>(from: &T) -> Result<Self> { + pub fn try_serialize<T: Serialize>(from: &T) -> Result<Self> { 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<T> { - self.try_into() + self.try_deserialize() } } |