From 99b95242016ddcfebe05de7d850b14de6cb7c941 Mon Sep 17 00:00:00 2001 From: Erick Tryzelaar Date: Tue, 31 Mar 2015 20:45:59 -0700 Subject: [PATCH] Change the name of ValueDeserializer::{,into_}deserializer --- src/de/value.rs | 26 +++++++++++++------------- src/json/de.rs | 2 +- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/de/value.rs b/src/de/value.rs index 288ebea7..4059453a 100644 --- a/src/de/value.rs +++ b/src/de/value.rs @@ -32,7 +32,7 @@ impl de::Error for Error { pub trait ValueDeserializer { type Deserializer: de::Deserializer; - fn deserializer(self) -> Self::Deserializer; + fn into_deserializer(self) -> Self::Deserializer; } /////////////////////////////////////////////////////////////////////////////// @@ -40,7 +40,7 @@ pub trait ValueDeserializer { impl ValueDeserializer for () { type Deserializer = UnitDeserializer; - fn deserializer(self) -> UnitDeserializer { + fn into_deserializer(self) -> UnitDeserializer { UnitDeserializer } } @@ -73,7 +73,7 @@ macro_rules! primitive_deserializer { impl ValueDeserializer for $ty { type Deserializer = $name; - fn deserializer(self) -> $name { + fn into_deserializer(self) -> $name { $name(Some(self)) } } @@ -116,7 +116,7 @@ pub struct StrDeserializer<'a>(Option<&'a str>); impl<'a> ValueDeserializer for &'a str { type Deserializer = StrDeserializer<'a>; - fn deserializer(self) -> StrDeserializer<'a> { + fn into_deserializer(self) -> StrDeserializer<'a> { StrDeserializer(Some(self)) } } @@ -164,7 +164,7 @@ pub struct StringDeserializer(Option); impl ValueDeserializer for String { type Deserializer = StringDeserializer; - fn deserializer(self) -> StringDeserializer { + fn into_deserializer(self) -> StringDeserializer { StringDeserializer(Some(self)) } } @@ -245,7 +245,7 @@ impl de::SeqVisitor for SeqDeserializer match self.iter.next() { Some(value) => { self.len -= 1; - let mut de = value.deserializer(); + let mut de = value.into_deserializer(); Ok(Some(try!(de::Deserialize::deserialize(&mut de)))) } None => Ok(None), @@ -272,7 +272,7 @@ impl ValueDeserializer for Vec { type Deserializer = SeqDeserializer>; - fn deserializer(self) -> SeqDeserializer> { + fn into_deserializer(self) -> SeqDeserializer> { let len = self.len(); SeqDeserializer::new(self.into_iter(), len) } @@ -283,7 +283,7 @@ impl ValueDeserializer for BTreeSet { type Deserializer = SeqDeserializer>; - fn deserializer(self) -> SeqDeserializer> { + fn into_deserializer(self) -> SeqDeserializer> { let len = self.len(); SeqDeserializer::new(self.into_iter(), len) } @@ -294,7 +294,7 @@ impl ValueDeserializer for HashSet { type Deserializer = SeqDeserializer>; - fn deserializer(self) -> SeqDeserializer> { + fn into_deserializer(self) -> SeqDeserializer> { let len = self.len(); SeqDeserializer::new(self.into_iter(), len) } @@ -354,7 +354,7 @@ impl de::MapVisitor for MapDeserializer Some((key, value)) => { self.len -= 1; self.value = Some(value); - let mut de = key.deserializer(); + let mut de = key.into_deserializer(); Ok(Some(try!(de::Deserialize::deserialize(&mut de)))) } None => Ok(None), @@ -366,7 +366,7 @@ impl de::MapVisitor for MapDeserializer { match self.value.take() { Some(value) => { - let mut de = value.deserializer(); + let mut de = value.into_deserializer(); de::Deserialize::deserialize(&mut de) } None => Err(de::Error::syntax_error()) @@ -394,7 +394,7 @@ impl ValueDeserializer for BTreeMap { type Deserializer = MapDeserializer, K, V>; - fn deserializer(self) -> MapDeserializer, K, V> { + fn into_deserializer(self) -> MapDeserializer, K, V> { let len = self.len(); MapDeserializer::new(self.into_iter(), len) } @@ -406,7 +406,7 @@ impl ValueDeserializer for HashMap { type Deserializer = MapDeserializer, K, V>; - fn deserializer(self) -> MapDeserializer, K, V> { + fn into_deserializer(self) -> MapDeserializer, K, V> { let len = self.len(); MapDeserializer::new(self.into_iter(), len) } diff --git a/src/json/de.rs b/src/json/de.rs index 5ea8f57c..e75bf3ca 100644 --- a/src/json/de.rs +++ b/src/json/de.rs @@ -603,7 +603,7 @@ impl<'a, Iter> de::MapVisitor for MapVisitor<'a, Iter> fn missing_field(&mut self, _field: &'static str) -> Result where V: de::Deserialize, { - let mut de = de::value::ValueDeserializer::deserializer(()); + let mut de = de::value::ValueDeserializer::into_deserializer(()); Ok(try!(de::Deserialize::deserialize(&mut de))) } }