From 7ace67e997982e522d3edbf92afc724105a14ec7 Mon Sep 17 00:00:00 2001 From: Joe Wilm Date: Tue, 26 Jan 2016 19:34:33 -0800 Subject: [PATCH] docs(readme) fix method calls on de/serializers Several instances of serializer and deserializer had methods like visit_* being invoked on them when the intent was to invoke de/serialize_*. --- README.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 2db17d44..9ecab2a6 100644 --- a/README.md +++ b/README.md @@ -256,7 +256,7 @@ impl serde::Serialize for i32 { fn serialize(&self, serializer: &mut S) -> Result<(), S::Error> where S: serde::Serializer, { - serializer.visit_i32(*self) + serializer.serialize_i32(*self) } } ``` @@ -277,7 +277,7 @@ impl Serialize for BTreeMap fn serialize(&self, serializer: &mut S) -> Result<(), S::Error> where S: Serializer, { - serializer.visit_map(MapIteratorVisitor::new(self.iter(), Some(self.len()))) + serializer.serialize_map(MapIteratorVisitor::new(self.iter(), Some(self.len()))) } } @@ -309,7 +309,7 @@ impl MapVisitor for MapIteratorVisitor { match self.iter.next() { Some((key, value)) => { - let value = try!(serializer.visit_map_elt(key, value)); + let value = try!(serializer.serialize_map_elt(key, value)); Ok(Some(value)) } None => Ok(None) @@ -339,7 +339,7 @@ impl serde::Serialize for Point { fn serialize(&self, serializer: &mut S) -> Result<(), S::Error> where S: serde::Serializer { - serializer.visit_struct("Point", PointMapVisitor { + serializer.serialize_struct("Point", PointMapVisitor { value: self, state: 0, }) @@ -358,11 +358,11 @@ impl<'a> serde::ser::MapVisitor for PointMapVisitor<'a> { match self.state { 0 => { self.state += 1; - Ok(Some(try!(serializer.visit_struct_elt("x", &self.value.x)))) + Ok(Some(try!(serializer.serialize_struct_elt("x", &self.value.x)))) } 1 => { self.state += 1; - Ok(Some(try!(serializer.visit_struct_elt("y", &self.value.y)))) + Ok(Some(try!(serializer.serialize_struct_elt("y", &self.value.y)))) } _ => { Ok(None) @@ -389,7 +389,7 @@ impl Deserialize for i32 { fn deserialize(deserializer: &mut D) -> Result where D: serde::Deserializer, { - deserializer.visit(I32Visitor) + deserializer.deserialize(I32Visitor) } } @@ -447,7 +447,7 @@ impl serde::Deserialize for BTreeMap fn deserialize(deserializer: &mut D) -> Result, D::Error> where D: serde::Deserializer, { - deserializer.visit(BTreeMapVisitor::new()) + deserializer.deserialize(BTreeMapVisitor::new()) } } @@ -530,7 +530,7 @@ impl serde::Deserialize for PointField { } } - deserializer.visit(PointFieldVisitor) + deserializer.deserialize(PointFieldVisitor) } } @@ -539,7 +539,7 @@ impl serde::Deserialize for Point { where D: serde::de::Deserializer { static FIELDS: &'static [&'static str] = &["x", "y"]; - deserializer.visit_struct("Point", FIELDS, PointVisitor) + deserializer.deserialize_struct("Point", FIELDS, PointVisitor) } }