Update README.md

fixes struct serialization example for rust 1.0.0-beta
This commit is contained in:
derhaskell 2015-04-13 13:27:15 +02:00
parent cca72f2dbc
commit ddda360fec

View File

@ -198,18 +198,18 @@ struct PointMapVisitor<'a> {
state: u8,
}
impl<'a> serde::ser::MapVisitor for PointMapVisitor {
fn visit<S>(&mut self, serializer: &mut S) -> Result<Option(), S::Error>
impl<'a> serde::ser::MapVisitor for PointMapVisitor<'a> {
fn visit<S>(&mut self, serializer: &mut S) -> Result<Option<()>, S::Error>
where S: serde::Serializer
{
match self.state {
0 => {
self.state += 1;
Ok(Some(try!(serializer.visit_map_elt("x", &self.x)))
Ok(Some(try!(serializer.visit_map_elt("x", &self.value.x)))
}
1 => {
self.state += 1;
Ok(Some(try!(serializer.visit_map_elt("y", &self.y))))
Ok(Some(try!(serializer.visit_map_elt("y", &self.value.y))))
}
_ => {
Ok(None)