checkpoint

This commit is contained in:
Erick Tryzelaar
2014-09-01 14:41:25 -07:00
parent 01716fbdcf
commit 3fb863475b
6 changed files with 833 additions and 563 deletions
+4 -4
View File
@@ -14,7 +14,7 @@ struct Foo {
impl<S: serde2::VisitorState<R>, R> serde2::Serialize<S, R> for Foo {
fn serialize(&self, state: &mut S) -> R {
state.serialize_struct("Foo", FooSerialize {
state.visit_struct("Foo", FooSerialize {
value: self,
state: 0,
})
@@ -31,15 +31,15 @@ impl<'a, S: serde2::VisitorState<R>, R> serde2::Visitor<S, R> for FooSerialize<'
match self.state {
0 => {
self.state += 1;
Some(state.serialize_map_elt(true, "x", &self.value.x))
Some(state.visit_map_elt(true, "x", &self.value.x))
}
1 => {
self.state += 1;
Some(state.serialize_map_elt(false, "y", &self.value.y))
Some(state.visit_map_elt(false, "y", &self.value.y))
}
2 => {
self.state += 1;
Some(state.serialize_map_elt(false, "z", &self.value.z))
Some(state.visit_map_elt(false, "z", &self.value.z))
}
_ => {
None