serde_macros 0.3.3

Macros to auto-generate implementations for the serde framework
#![feature(no_std)]
#![no_std]
#![feature(custom_derive,
           plugin,
           plugin_registrar,
           rustc_private,
           unboxed_closures)]
#![plugin(quasi_macros)]
#[prelude_import]
use std::prelude::v1::*;
#[macro_use]
extern crate "std" as std;

extern crate aster;
extern crate quasi;
extern crate rustc;
extern crate syntax;

use syntax::ext::base::Decorator;
use syntax::parse::token;
use rustc::plugin::Registry;

mod ser {
    #[prelude_import]
    use std::prelude::v1::*;


    use syntax::ast::{Ident, MetaItem, Item, Expr, StructDef};
    use syntax::ast;
    use syntax::codemap::Span;
    use syntax::ext::base::ExtCtxt;
    use syntax::ext::build::AstBuilder;
    use syntax::ptr::P;
    use aster;
    use field::struct_field_strs;
    pub fn expand_derive_serialize(cx: &mut ExtCtxt, span: Span,
                                   _mitem: &MetaItem, item: &Item,
                                   push: &mut FnMut(P<ast::Item>)) {
        let builder = aster::AstBuilder::new().span(span);
        let generics =
            match item.node {
                ast::ItemStruct(_, ref generics) => generics,
                ast::ItemEnum(_, ref generics) => generics,
                _ =>
                cx.bug("expected ItemStruct or ItemEnum in #[derive_serialize]"),
            };
        let impl_generics =
            builder.from_generics(generics.clone()).add_ty_param_bound(builder.path().global().ids(&["serde",
                                                                                                     "ser",
                                                                                                     "Serialize"]).build()).build();
        let ty =
            builder.ty().path().segment(item.ident).with_generics(impl_generics.clone()).build().build();
        let body =
            serialize_body(cx, &builder, item, &impl_generics, ty.clone());
        let where_clause = &impl_generics.where_clause;
        let impl_item =
            {
                #[allow(unused_imports)]
                use quasi::*;
                let ext_cx = &*cx;
                new_parser_from_tts(ext_cx.parse_sess(), ext_cx.cfg(),
                                    {
                                        let _sp = ext_cx.call_site();
                                        let mut tt = ::std::vec::Vec::new();
                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                       ::syntax::parse::token::Pound));
                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                       ::syntax::parse::token::OpenDelim(::syntax::parse::token::Bracket)));
                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                       ::syntax::parse::token::Ident(ext_cx.ident_of("automatically_derived"),
                                                                                                     ::syntax::parse::token::Plain)));
                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                       ::syntax::parse::token::CloseDelim(::syntax::parse::token::Bracket)));
                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                       ::syntax::parse::token::Ident(ext_cx.ident_of("impl"),
                                                                                                     ::syntax::parse::token::Plain)));
                                        tt.extend(impl_generics.to_tokens(ext_cx).into_iter());
                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                       ::syntax::parse::token::ModSep));
                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                       ::syntax::parse::token::Ident(ext_cx.ident_of("serde"),
                                                                                                     ::syntax::parse::token::ModName)));
                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                       ::syntax::parse::token::ModSep));
                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                       ::syntax::parse::token::Ident(ext_cx.ident_of("ser"),
                                                                                                     ::syntax::parse::token::ModName)));
                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                       ::syntax::parse::token::ModSep));
                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                       ::syntax::parse::token::Ident(ext_cx.ident_of("Serialize"),
                                                                                                     ::syntax::parse::token::Plain)));
                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                       ::syntax::parse::token::Ident(ext_cx.ident_of("for"),
                                                                                                     ::syntax::parse::token::Plain)));
                                        tt.extend(ty.to_tokens(ext_cx).into_iter());
                                        tt.extend(where_clause.to_tokens(ext_cx).into_iter());
                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                       ::syntax::parse::token::OpenDelim(::syntax::parse::token::Brace)));
                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                       ::syntax::parse::token::Ident(ext_cx.ident_of("fn"),
                                                                                                     ::syntax::parse::token::Plain)));
                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                       ::syntax::parse::token::Ident(ext_cx.ident_of("serialize"),
                                                                                                     ::syntax::parse::token::Plain)));
                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                       ::syntax::parse::token::Lt));
                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                       ::syntax::parse::token::Ident(ext_cx.ident_of("__S"),
                                                                                                     ::syntax::parse::token::Plain)));
                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                       ::syntax::parse::token::Gt));
                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                       ::syntax::parse::token::OpenDelim(::syntax::parse::token::Paren)));
                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                       ::syntax::parse::token::BinOp(::syntax::parse::token::And)));
                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                       ::syntax::parse::token::Ident(ext_cx.ident_of("self"),
                                                                                                     ::syntax::parse::token::Plain)));
                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                       ::syntax::parse::token::Comma));
                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                       ::syntax::parse::token::Ident(ext_cx.ident_of("serializer"),
                                                                                                     ::syntax::parse::token::Plain)));
                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                       ::syntax::parse::token::Colon));
                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                       ::syntax::parse::token::BinOp(::syntax::parse::token::And)));
                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                       ::syntax::parse::token::Ident(ext_cx.ident_of("mut"),
                                                                                                     ::syntax::parse::token::Plain)));
                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                       ::syntax::parse::token::Ident(ext_cx.ident_of("__S"),
                                                                                                     ::syntax::parse::token::Plain)));
                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                       ::syntax::parse::token::CloseDelim(::syntax::parse::token::Paren)));
                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                       ::syntax::parse::token::RArrow));
                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                       ::syntax::parse::token::Ident(ext_cx.ident_of("Result"),
                                                                                                     ::syntax::parse::token::Plain)));
                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                       ::syntax::parse::token::Lt));
                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                       ::syntax::parse::token::OpenDelim(::syntax::parse::token::Paren)));
                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                       ::syntax::parse::token::CloseDelim(::syntax::parse::token::Paren)));
                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                       ::syntax::parse::token::Comma));
                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                       ::syntax::parse::token::Ident(ext_cx.ident_of("__S"),
                                                                                                     ::syntax::parse::token::ModName)));
                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                       ::syntax::parse::token::ModSep));
                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                       ::syntax::parse::token::Ident(ext_cx.ident_of("Error"),
                                                                                                     ::syntax::parse::token::Plain)));
                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                       ::syntax::parse::token::Gt));
                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                       ::syntax::parse::token::Ident(ext_cx.ident_of("where"),
                                                                                                     ::syntax::parse::token::Plain)));
                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                       ::syntax::parse::token::Ident(ext_cx.ident_of("__S"),
                                                                                                     ::syntax::parse::token::Plain)));
                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                       ::syntax::parse::token::Colon));
                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                       ::syntax::parse::token::ModSep));
                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                       ::syntax::parse::token::Ident(ext_cx.ident_of("serde"),
                                                                                                     ::syntax::parse::token::ModName)));
                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                       ::syntax::parse::token::ModSep));
                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                       ::syntax::parse::token::Ident(ext_cx.ident_of("ser"),
                                                                                                     ::syntax::parse::token::ModName)));
                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                       ::syntax::parse::token::ModSep));
                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                       ::syntax::parse::token::Ident(ext_cx.ident_of("Serializer"),
                                                                                                     ::syntax::parse::token::Plain)));
                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                       ::syntax::parse::token::Comma));
                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                       ::syntax::parse::token::OpenDelim(::syntax::parse::token::Brace)));
                                        tt.extend(body.to_tokens(ext_cx).into_iter());
                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                       ::syntax::parse::token::CloseDelim(::syntax::parse::token::Brace)));
                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                       ::syntax::parse::token::CloseDelim(::syntax::parse::token::Brace)));
                                        tt
                                    }).parse_item_with_outer_attributes()
            }.unwrap();
        push(impl_item)
    }
    fn serialize_body(cx: &ExtCtxt, builder: &aster::AstBuilder, item: &Item,
                      impl_generics: &ast::Generics, ty: P<ast::Ty>)
     -> P<ast::Expr> {
        match item.node {
            ast::ItemStruct(ref struct_def, _) => {
                serialize_item_struct(cx, builder, item, impl_generics, ty,
                                      struct_def)
            }
            ast::ItemEnum(ref enum_def, _) => {
                serialize_item_enum(cx, builder, item.ident, impl_generics,
                                    enum_def)
            }
            _ =>
            cx.bug("expected ItemStruct or ItemEnum in #[derive_serialize]"),
        }
    }
    fn serialize_item_struct(cx: &ExtCtxt, builder: &aster::AstBuilder,
                             item: &Item, impl_generics: &ast::Generics,
                             ty: P<ast::Ty>, struct_def: &ast::StructDef)
     -> P<ast::Expr> {
        let mut named_fields =
            <[_] as
                ::std::slice::SliceExt>::into_vec(::std::boxed::Box::new([]));
        let mut unnamed_fields = 0;
        {
            let result =
                match ::std::iter::IntoIterator::into_iter(struct_def.fields.iter())
                    {
                    mut iter =>
                    loop  {
                        match ::std::iter::Iterator::next(&mut iter) {
                            ::std::option::Option::Some(field) => {
                                match field.node.kind {
                                    ast::NamedField(name, _) => {
                                        named_fields.push(name);
                                    }
                                    ast::UnnamedField(_) => {
                                        unnamed_fields += 1;
                                    }
                                }
                            }
                            ::std::option::Option::None => break ,
                        }
                    },
                };
            result
        }
        match (named_fields.is_empty(), unnamed_fields == 0) {
            (true, true) => {
                serialize_unit_struct(cx, &builder, item.ident)
            }
            (true, false) => {
                serialize_tuple_struct(cx, &builder, item.ident,
                                       impl_generics, ty, unnamed_fields)
            }
            (false, true) => {
                serialize_struct(cx, &builder, item.ident, impl_generics, ty,
                                 struct_def, named_fields)
            }
            (false, false) => {
                cx.bug("struct has named and unnamed fields")
            }
        }
    }
    fn serialize_unit_struct(cx: &ExtCtxt, builder: &aster::AstBuilder,
                             type_ident: Ident) -> P<ast::Expr> {
        let type_name = builder.expr().str(type_ident);
        {
            #[allow(unused_imports)]
            use quasi::*;
            let ext_cx = &*cx;
            new_parser_from_tts(ext_cx.parse_sess(), ext_cx.cfg(),
                                {
                                    let _sp = ext_cx.call_site();
                                    let mut tt = ::std::vec::Vec::new();
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("serializer"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Dot));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("visit_named_unit"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::OpenDelim(::syntax::parse::token::Paren)));
                                    tt.extend(type_name.to_tokens(ext_cx).into_iter());
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::CloseDelim(::syntax::parse::token::Paren)));
                                    tt
                                }).parse_expr()
        }
    }
    fn serialize_tuple_struct(cx: &ExtCtxt, builder: &aster::AstBuilder,
                              type_ident: Ident,
                              impl_generics: &ast::Generics, ty: P<ast::Ty>,
                              fields: usize) -> P<ast::Expr> {
        let value_ty = builder.ty().ref_().lifetime("\'__a").build_ty(ty);
        let (visitor_struct, visitor_impl) =
            serialize_tuple_struct_visitor(cx, builder, value_ty, fields,
                                           impl_generics);
        let type_name = builder.expr().str(type_ident);
        {
            #[allow(unused_imports)]
            use quasi::*;
            let ext_cx = &*cx;
            new_parser_from_tts(ext_cx.parse_sess(), ext_cx.cfg(),
                                {
                                    let _sp = ext_cx.call_site();
                                    let mut tt = ::std::vec::Vec::new();
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::OpenDelim(::syntax::parse::token::Brace)));
                                    tt.extend(visitor_struct.to_tokens(ext_cx).into_iter());
                                    tt.extend(visitor_impl.to_tokens(ext_cx).into_iter());
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("serializer"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Dot));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("visit_named_seq"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::OpenDelim(::syntax::parse::token::Paren)));
                                    tt.extend(type_name.to_tokens(ext_cx).into_iter());
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Comma));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("Visitor"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::OpenDelim(::syntax::parse::token::Brace)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("value"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Colon));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("self"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Comma));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("state"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Colon));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Literal(::syntax::parse::token::Integer(ext_cx.name_of("0")),
                                                                                                   ::std::option::Option::None)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Comma));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::CloseDelim(::syntax::parse::token::Brace)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::CloseDelim(::syntax::parse::token::Paren)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::CloseDelim(::syntax::parse::token::Brace)));
                                    tt
                                }).parse_expr()
        }
    }
    fn serialize_struct(cx: &ExtCtxt, builder: &aster::AstBuilder,
                        type_ident: Ident, impl_generics: &ast::Generics,
                        ty: P<ast::Ty>, struct_def: &StructDef,
                        fields: Vec<Ident>) -> P<ast::Expr> {
        let value_ty =
            builder.ty().ref_().lifetime("\'__a").build_ty(ty.clone());
        let (visitor_struct, visitor_impl) =
            serialize_struct_visitor(cx, builder, value_ty, struct_def,
                                     impl_generics,
                                     fields.iter().map(|field| {
                                                       #[allow(unused_imports)]
                                                       use quasi::*;
                                                       let ext_cx = &*cx;
                                                       new_parser_from_tts(ext_cx.parse_sess(),
                                                                           ext_cx.cfg(),
                                                                           {
                                                                               let _sp =
                                                                                   ext_cx.call_site();
                                                                               let mut tt =
                                                                                   ::std::vec::Vec::new();
                                                                               tt.push(::syntax::ast::TtToken(_sp,
                                                                                                              ::syntax::parse::token::BinOp(::syntax::parse::token::And)));
                                                                               tt.push(::syntax::ast::TtToken(_sp,
                                                                                                              ::syntax::parse::token::Ident(ext_cx.ident_of("self"),
                                                                                                                                            ::syntax::parse::token::Plain)));
                                                                               tt.push(::syntax::ast::TtToken(_sp,
                                                                                                              ::syntax::parse::token::Dot));
                                                                               tt.push(::syntax::ast::TtToken(_sp,
                                                                                                              ::syntax::parse::token::Ident(ext_cx.ident_of("value"),
                                                                                                                                            ::syntax::parse::token::Plain)));
                                                                               tt.push(::syntax::ast::TtToken(_sp,
                                                                                                              ::syntax::parse::token::Dot));
                                                                               tt.extend(field.to_tokens(ext_cx).into_iter());
                                                                               tt
                                                                           }).parse_expr()
                                                   }));
        let type_name = builder.expr().str(type_ident);
        {
            #[allow(unused_imports)]
            use quasi::*;
            let ext_cx = &*cx;
            new_parser_from_tts(ext_cx.parse_sess(), ext_cx.cfg(),
                                {
                                    let _sp = ext_cx.call_site();
                                    let mut tt = ::std::vec::Vec::new();
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::OpenDelim(::syntax::parse::token::Brace)));
                                    tt.extend(visitor_struct.to_tokens(ext_cx).into_iter());
                                    tt.extend(visitor_impl.to_tokens(ext_cx).into_iter());
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("serializer"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Dot));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("visit_named_map"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::OpenDelim(::syntax::parse::token::Paren)));
                                    tt.extend(type_name.to_tokens(ext_cx).into_iter());
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Comma));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("Visitor"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::OpenDelim(::syntax::parse::token::Brace)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("value"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Colon));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("self"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Comma));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("state"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Colon));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Literal(::syntax::parse::token::Integer(ext_cx.name_of("0")),
                                                                                                   ::std::option::Option::None)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Comma));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::CloseDelim(::syntax::parse::token::Brace)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::CloseDelim(::syntax::parse::token::Paren)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::CloseDelim(::syntax::parse::token::Brace)));
                                    tt
                                }).parse_expr()
        }
    }
    fn serialize_item_enum(cx: &ExtCtxt, builder: &aster::AstBuilder,
                           type_ident: Ident, impl_generics: &ast::Generics,
                           enum_def: &ast::EnumDef) -> P<ast::Expr> {
        let arms: Vec<ast::Arm> =
            enum_def.variants.iter().map(|variant| {
                                         serialize_variant(cx, builder,
                                                           type_ident,
                                                           impl_generics,
                                                           variant)
                                     }).collect();
        {
            #[allow(unused_imports)]
            use quasi::*;
            let ext_cx = &*cx;
            new_parser_from_tts(ext_cx.parse_sess(), ext_cx.cfg(),
                                {
                                    let _sp = ext_cx.call_site();
                                    let mut tt = ::std::vec::Vec::new();
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("match"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::BinOp(::syntax::parse::token::Star)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("self"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::OpenDelim(::syntax::parse::token::Brace)));
                                    tt.extend(arms.to_tokens(ext_cx).into_iter());
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::CloseDelim(::syntax::parse::token::Brace)));
                                    tt
                                }).parse_expr()
        }
    }
    fn serialize_variant(cx: &ExtCtxt, builder: &aster::AstBuilder,
                         type_ident: Ident, generics: &ast::Generics,
                         variant: &ast::Variant) -> ast::Arm {
        let type_name = builder.expr().str(type_ident);
        let variant_ident = variant.node.name;
        let variant_name = builder.expr().str(variant_ident);
        match variant.node.kind {
            ast::TupleVariantKind(ref args) if args.is_empty() => {
                let pat =
                    builder.pat().enum_().id(type_ident).id(variant_ident).build().build();
                {
                    #[allow(unused_imports)]
                    use quasi::*;
                    let ext_cx = &*cx;
                    new_parser_from_tts(ext_cx.parse_sess(), ext_cx.cfg(),
                                        {
                                            let _sp = ext_cx.call_site();
                                            let mut tt =
                                                ::std::vec::Vec::new();
                                            tt.extend(pat.to_tokens(ext_cx).into_iter());
                                            tt.push(::syntax::ast::TtToken(_sp,
                                                                           ::syntax::parse::token::FatArrow));
                                            tt.push(::syntax::ast::TtToken(_sp,
                                                                           ::syntax::parse::token::OpenDelim(::syntax::parse::token::Brace)));
                                            tt.push(::syntax::ast::TtToken(_sp,
                                                                           ::syntax::parse::token::ModSep));
                                            tt.push(::syntax::ast::TtToken(_sp,
                                                                           ::syntax::parse::token::Ident(ext_cx.ident_of("serde"),
                                                                                                         ::syntax::parse::token::ModName)));
                                            tt.push(::syntax::ast::TtToken(_sp,
                                                                           ::syntax::parse::token::ModSep));
                                            tt.push(::syntax::ast::TtToken(_sp,
                                                                           ::syntax::parse::token::Ident(ext_cx.ident_of("ser"),
                                                                                                         ::syntax::parse::token::ModName)));
                                            tt.push(::syntax::ast::TtToken(_sp,
                                                                           ::syntax::parse::token::ModSep));
                                            tt.push(::syntax::ast::TtToken(_sp,
                                                                           ::syntax::parse::token::Ident(ext_cx.ident_of("Serializer"),
                                                                                                         ::syntax::parse::token::ModName)));
                                            tt.push(::syntax::ast::TtToken(_sp,
                                                                           ::syntax::parse::token::ModSep));
                                            tt.push(::syntax::ast::TtToken(_sp,
                                                                           ::syntax::parse::token::Ident(ext_cx.ident_of("visit_enum_unit"),
                                                                                                         ::syntax::parse::token::Plain)));
                                            tt.push(::syntax::ast::TtToken(_sp,
                                                                           ::syntax::parse::token::OpenDelim(::syntax::parse::token::Paren)));
                                            tt.push(::syntax::ast::TtToken(_sp,
                                                                           ::syntax::parse::token::Ident(ext_cx.ident_of("serializer"),
                                                                                                         ::syntax::parse::token::Plain)));
                                            tt.push(::syntax::ast::TtToken(_sp,
                                                                           ::syntax::parse::token::Comma));
                                            tt.extend(type_name.to_tokens(ext_cx).into_iter());
                                            tt.push(::syntax::ast::TtToken(_sp,
                                                                           ::syntax::parse::token::Comma));
                                            tt.extend(variant_name.to_tokens(ext_cx).into_iter());
                                            tt.push(::syntax::ast::TtToken(_sp,
                                                                           ::syntax::parse::token::Comma));
                                            tt.push(::syntax::ast::TtToken(_sp,
                                                                           ::syntax::parse::token::CloseDelim(::syntax::parse::token::Paren)));
                                            tt.push(::syntax::ast::TtToken(_sp,
                                                                           ::syntax::parse::token::CloseDelim(::syntax::parse::token::Brace)));
                                            tt.push(::syntax::ast::TtToken(_sp,
                                                                           ::syntax::parse::token::Comma));
                                            tt
                                        }).parse_arm()
                }
            }
            ast::TupleVariantKind(ref args) => {
                let fields: Vec<ast::Ident> =
                    (0..args.len()).map(|i|
                                            builder.id(::std::fmt::format(::std::fmt::Arguments::new_v1({
                                                                                                            static __STATIC_FMTSTR:
                                                                                                                   &'static [&'static str]
                                                                                                                   =
                                                                                                                &["__field"];
                                                                                                            __STATIC_FMTSTR
                                                                                                        },
                                                                                                        &match (&i,)
                                                                                                             {
                                                                                                             (__arg0,)
                                                                                                             =>
                                                                                                             [::std::fmt::ArgumentV1::new(__arg0,
                                                                                                                                          ::std::fmt::Display::fmt)],
                                                                                                         })))).collect();
                let pat =
                    builder.pat().enum_().id(type_ident).id(variant_ident).build().with_pats(fields.iter().map(|field|
                                                                                                                   builder.pat().ref_id(field))).build();
                let expr =
                    serialize_tuple_variant(cx, builder, type_name,
                                            variant_name, generics, args,
                                            fields);
                {
                    #[allow(unused_imports)]
                    use quasi::*;
                    let ext_cx = &*cx;
                    new_parser_from_tts(ext_cx.parse_sess(), ext_cx.cfg(),
                                        {
                                            let _sp = ext_cx.call_site();
                                            let mut tt =
                                                ::std::vec::Vec::new();
                                            tt.extend(pat.to_tokens(ext_cx).into_iter());
                                            tt.push(::syntax::ast::TtToken(_sp,
                                                                           ::syntax::parse::token::FatArrow));
                                            tt.push(::syntax::ast::TtToken(_sp,
                                                                           ::syntax::parse::token::OpenDelim(::syntax::parse::token::Brace)));
                                            tt.extend(expr.to_tokens(ext_cx).into_iter());
                                            tt.push(::syntax::ast::TtToken(_sp,
                                                                           ::syntax::parse::token::CloseDelim(::syntax::parse::token::Brace)));
                                            tt
                                        }).parse_arm()
                }
            }
            ast::StructVariantKind(ref struct_def) => {
                let fields: Vec<_> =
                    (0..struct_def.fields.len()).map(|i|
                                                         builder.id(::std::fmt::format(::std::fmt::Arguments::new_v1({
                                                                                                                         static __STATIC_FMTSTR:
                                                                                                                                &'static [&'static str]
                                                                                                                                =
                                                                                                                             &["__field"];
                                                                                                                         __STATIC_FMTSTR
                                                                                                                     },
                                                                                                                     &match (&i,)
                                                                                                                          {
                                                                                                                          (__arg0,)
                                                                                                                          =>
                                                                                                                          [::std::fmt::ArgumentV1::new(__arg0,
                                                                                                                                                       ::std::fmt::Display::fmt)],
                                                                                                                      })))).collect();
                let pat =
                    builder.pat().struct_().id(type_ident).id(variant_ident).build().with_pats(fields.iter().zip(struct_def.fields.iter()).map(|(id,
                                                                                                                                                 field)|
                                                                                                                                                   {
                                                                                                                                               let name =
                                                                                                                                                   match field.node.kind
                                                                                                                                                       {
                                                                                                                                                       ast::NamedField(name,
                                                                                                                                                                       _)
                                                                                                                                                       =>
                                                                                                                                                       name,
                                                                                                                                                       ast::UnnamedField(_)
                                                                                                                                                       =>
                                                                                                                                                       {
                                                                                                                                                           cx.bug("struct variant has unnamed fields")
                                                                                                                                                       }
                                                                                                                                                   };
                                                                                                                                               (name,
                                                                                                                                                builder.pat().ref_id(id))
                                                                                                                                           })).build();
                let expr =
                    serialize_struct_variant(cx, builder, type_name,
                                             variant_name, generics,
                                             struct_def, fields);
                {
                    #[allow(unused_imports)]
                    use quasi::*;
                    let ext_cx = &*cx;
                    new_parser_from_tts(ext_cx.parse_sess(), ext_cx.cfg(),
                                        {
                                            let _sp = ext_cx.call_site();
                                            let mut tt =
                                                ::std::vec::Vec::new();
                                            tt.extend(pat.to_tokens(ext_cx).into_iter());
                                            tt.push(::syntax::ast::TtToken(_sp,
                                                                           ::syntax::parse::token::FatArrow));
                                            tt.push(::syntax::ast::TtToken(_sp,
                                                                           ::syntax::parse::token::OpenDelim(::syntax::parse::token::Brace)));
                                            tt.extend(expr.to_tokens(ext_cx).into_iter());
                                            tt.push(::syntax::ast::TtToken(_sp,
                                                                           ::syntax::parse::token::CloseDelim(::syntax::parse::token::Brace)));
                                            tt
                                        }).parse_arm()
                }
            }
        }
    }
    fn serialize_tuple_variant(cx: &ExtCtxt, builder: &aster::AstBuilder,
                               type_name: P<ast::Expr>,
                               variant_name: P<ast::Expr>,
                               generics: &ast::Generics,
                               args: &[ast::VariantArg], fields: Vec<Ident>)
     -> P<ast::Expr> {
        let value_ty =
            builder.ty().tuple().with_tys(args.iter().map(|arg| {
                                                          builder.ty().ref_().lifetime("\'__a").build_ty(arg.ty.clone())
                                                      })).build();
        let value_expr =
            builder.expr().tuple().with_exprs(fields.iter().map(|field| {
                                                                builder.expr().addr_of().id(field)
                                                            })).build();
        let (visitor_struct, visitor_impl) =
            serialize_tuple_struct_visitor(cx, builder, value_ty, args.len(),
                                           generics);
        {
            #[allow(unused_imports)]
            use quasi::*;
            let ext_cx = &*cx;
            new_parser_from_tts(ext_cx.parse_sess(), ext_cx.cfg(),
                                {
                                    let _sp = ext_cx.call_site();
                                    let mut tt = ::std::vec::Vec::new();
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::OpenDelim(::syntax::parse::token::Brace)));
                                    tt.extend(visitor_struct.to_tokens(ext_cx).into_iter());
                                    tt.extend(visitor_impl.to_tokens(ext_cx).into_iter());
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("serializer"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Dot));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("visit_enum_seq"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::OpenDelim(::syntax::parse::token::Paren)));
                                    tt.extend(type_name.to_tokens(ext_cx).into_iter());
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Comma));
                                    tt.extend(variant_name.to_tokens(ext_cx).into_iter());
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Comma));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("Visitor"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::OpenDelim(::syntax::parse::token::Brace)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("value"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Colon));
                                    tt.extend(value_expr.to_tokens(ext_cx).into_iter());
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Comma));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("state"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Colon));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Literal(::syntax::parse::token::Integer(ext_cx.name_of("0")),
                                                                                                   ::std::option::Option::None)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Comma));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::CloseDelim(::syntax::parse::token::Brace)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::CloseDelim(::syntax::parse::token::Paren)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::CloseDelim(::syntax::parse::token::Brace)));
                                    tt
                                }).parse_expr()
        }
    }
    fn serialize_struct_variant(cx: &ExtCtxt, builder: &aster::AstBuilder,
                                type_name: P<ast::Expr>,
                                variant_name: P<ast::Expr>,
                                generics: &ast::Generics,
                                struct_def: &ast::StructDef,
                                fields: Vec<Ident>) -> P<ast::Expr> {
        let value_ty =
            builder.ty().tuple().with_tys(struct_def.fields.iter().map(|field|
                                                                           {
                                                                       builder.ty().ref_().lifetime("\'__a").build_ty(field.node.ty.clone())
                                                                   })).build();
        let value_expr =
            builder.expr().tuple().with_exprs(fields.iter().map(|field| {
                                                                builder.expr().addr_of().id(field)
                                                            })).build();
        let (visitor_struct, visitor_impl) =
            serialize_struct_visitor(cx, builder, value_ty, struct_def,
                                     generics,
                                     (0..fields.len()).map(|i| {
                                                           builder.expr().tup_field(i).field("value").self_()
                                                       }));
        {
            #[allow(unused_imports)]
            use quasi::*;
            let ext_cx = &*cx;
            new_parser_from_tts(ext_cx.parse_sess(), ext_cx.cfg(),
                                {
                                    let _sp = ext_cx.call_site();
                                    let mut tt = ::std::vec::Vec::new();
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::OpenDelim(::syntax::parse::token::Brace)));
                                    tt.extend(visitor_struct.to_tokens(ext_cx).into_iter());
                                    tt.extend(visitor_impl.to_tokens(ext_cx).into_iter());
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("serializer"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Dot));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("visit_enum_map"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::OpenDelim(::syntax::parse::token::Paren)));
                                    tt.extend(type_name.to_tokens(ext_cx).into_iter());
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Comma));
                                    tt.extend(variant_name.to_tokens(ext_cx).into_iter());
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Comma));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("Visitor"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::OpenDelim(::syntax::parse::token::Brace)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("value"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Colon));
                                    tt.extend(value_expr.to_tokens(ext_cx).into_iter());
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Comma));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("state"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Colon));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Literal(::syntax::parse::token::Integer(ext_cx.name_of("0")),
                                                                                                   ::std::option::Option::None)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Comma));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::CloseDelim(::syntax::parse::token::Brace)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::CloseDelim(::syntax::parse::token::Paren)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::CloseDelim(::syntax::parse::token::Brace)));
                                    tt
                                }).parse_expr()
        }
    }
    fn serialize_tuple_struct_visitor(cx: &ExtCtxt,
                                      builder: &aster::AstBuilder,
                                      value_ty: P<ast::Ty>, fields: usize,
                                      generics: &ast::Generics)
     -> (P<ast::Item>, P<ast::Item>) {
        let arms: Vec<ast::Arm> =
            (0..fields).map(|i| {
                            let expr =
                                builder.expr().tup_field(i).field("value").self_();
                            {
                                #[allow(unused_imports)]
                                use quasi::*;
                                let ext_cx = &*cx;
                                new_parser_from_tts(ext_cx.parse_sess(),
                                                    ext_cx.cfg(),
                                                    {
                                                        let _sp =
                                                            ext_cx.call_site();
                                                        let mut tt =
                                                            ::std::vec::Vec::new();
                                                        tt.extend(i.to_tokens(ext_cx).into_iter());
                                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                                       ::syntax::parse::token::FatArrow));
                                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                                       ::syntax::parse::token::OpenDelim(::syntax::parse::token::Brace)));
                                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                                       ::syntax::parse::token::Ident(ext_cx.ident_of("self"),
                                                                                                                     ::syntax::parse::token::Plain)));
                                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                                       ::syntax::parse::token::Dot));
                                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                                       ::syntax::parse::token::Ident(ext_cx.ident_of("state"),
                                                                                                                     ::syntax::parse::token::Plain)));
                                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                                       ::syntax::parse::token::BinOpEq(::syntax::parse::token::Plus)));
                                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                                       ::syntax::parse::token::Literal(::syntax::parse::token::Integer(ext_cx.name_of("1")),
                                                                                                                       ::std::option::Option::None)));
                                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                                       ::syntax::parse::token::Semi));
                                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                                       ::syntax::parse::token::Ident(ext_cx.ident_of("let"),
                                                                                                                     ::syntax::parse::token::Plain)));
                                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                                       ::syntax::parse::token::Ident(ext_cx.ident_of("v"),
                                                                                                                     ::syntax::parse::token::Plain)));
                                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                                       ::syntax::parse::token::Eq));
                                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                                       ::syntax::parse::token::Ident(ext_cx.ident_of("try"),
                                                                                                                     ::syntax::parse::token::Plain)));
                                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                                       ::syntax::parse::token::Not));
                                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                                       ::syntax::parse::token::OpenDelim(::syntax::parse::token::Paren)));
                                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                                       ::syntax::parse::token::Ident(ext_cx.ident_of("serializer"),
                                                                                                                     ::syntax::parse::token::Plain)));
                                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                                       ::syntax::parse::token::Dot));
                                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                                       ::syntax::parse::token::Ident(ext_cx.ident_of("visit_seq_elt"),
                                                                                                                     ::syntax::parse::token::Plain)));
                                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                                       ::syntax::parse::token::OpenDelim(::syntax::parse::token::Paren)));
                                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                                       ::syntax::parse::token::BinOp(::syntax::parse::token::And)));
                                                        tt.extend(expr.to_tokens(ext_cx).into_iter());
                                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                                       ::syntax::parse::token::CloseDelim(::syntax::parse::token::Paren)));
                                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                                       ::syntax::parse::token::CloseDelim(::syntax::parse::token::Paren)));
                                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                                       ::syntax::parse::token::Semi));
                                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                                       ::syntax::parse::token::Ident(ext_cx.ident_of("Ok"),
                                                                                                                     ::syntax::parse::token::Plain)));
                                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                                       ::syntax::parse::token::OpenDelim(::syntax::parse::token::Paren)));
                                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                                       ::syntax::parse::token::Ident(ext_cx.ident_of("Some"),
                                                                                                                     ::syntax::parse::token::Plain)));
                                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                                       ::syntax::parse::token::OpenDelim(::syntax::parse::token::Paren)));
                                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                                       ::syntax::parse::token::Ident(ext_cx.ident_of("v"),
                                                                                                                     ::syntax::parse::token::Plain)));
                                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                                       ::syntax::parse::token::CloseDelim(::syntax::parse::token::Paren)));
                                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                                       ::syntax::parse::token::CloseDelim(::syntax::parse::token::Paren)));
                                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                                       ::syntax::parse::token::CloseDelim(::syntax::parse::token::Brace)));
                                                        tt
                                                    }).parse_arm()
                            } }).collect();
        let visitor_impl_generics =
            builder.from_generics(generics.clone()).add_lifetime_bound("\'__a").lifetime_name("\'__a").build();
        let where_clause = &visitor_impl_generics.where_clause;
        let visitor_generics =
            builder.from_generics(visitor_impl_generics.clone()).strip_bounds().build();
        ({
             #[allow(unused_imports)]
             use quasi::*;
             let ext_cx = &*cx;
             new_parser_from_tts(ext_cx.parse_sess(), ext_cx.cfg(),
                                 {
                                     let _sp = ext_cx.call_site();
                                     let mut tt = ::std::vec::Vec::new();
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Ident(ext_cx.ident_of("struct"),
                                                                                                  ::syntax::parse::token::Plain)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Ident(ext_cx.ident_of("Visitor"),
                                                                                                  ::syntax::parse::token::Plain)));
                                     tt.extend(visitor_impl_generics.to_tokens(ext_cx).into_iter());
                                     tt.extend(where_clause.to_tokens(ext_cx).into_iter());
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::OpenDelim(::syntax::parse::token::Brace)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Ident(ext_cx.ident_of("state"),
                                                                                                  ::syntax::parse::token::Plain)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Colon));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Ident(ext_cx.ident_of("usize"),
                                                                                                  ::syntax::parse::token::Plain)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Comma));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Ident(ext_cx.ident_of("value"),
                                                                                                  ::syntax::parse::token::Plain)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Colon));
                                     tt.extend(value_ty.to_tokens(ext_cx).into_iter());
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Comma));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::CloseDelim(::syntax::parse::token::Brace)));
                                     tt
                                 }).parse_item_with_outer_attributes()
         }.unwrap(),
         {
             #[allow(unused_imports)]
             use quasi::*;
             let ext_cx = &*cx;
             new_parser_from_tts(ext_cx.parse_sess(), ext_cx.cfg(),
                                 {
                                     let _sp = ext_cx.call_site();
                                     let mut tt = ::std::vec::Vec::new();
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Ident(ext_cx.ident_of("impl"),
                                                                                                  ::syntax::parse::token::Plain)));
                                     tt.extend(visitor_impl_generics.to_tokens(ext_cx).into_iter());
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::ModSep));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Ident(ext_cx.ident_of("serde"),
                                                                                                  ::syntax::parse::token::ModName)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::ModSep));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Ident(ext_cx.ident_of("ser"),
                                                                                                  ::syntax::parse::token::ModName)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::ModSep));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Ident(ext_cx.ident_of("SeqVisitor"),
                                                                                                  ::syntax::parse::token::Plain)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Ident(ext_cx.ident_of("for"),
                                                                                                  ::syntax::parse::token::Plain)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Ident(ext_cx.ident_of("Visitor"),
                                                                                                  ::syntax::parse::token::Plain)));
                                     tt.extend(visitor_generics.to_tokens(ext_cx).into_iter());
                                     tt.extend(where_clause.to_tokens(ext_cx).into_iter());
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::OpenDelim(::syntax::parse::token::Brace)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Pound));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::OpenDelim(::syntax::parse::token::Bracket)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Ident(ext_cx.ident_of("inline"),
                                                                                                  ::syntax::parse::token::Plain)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::CloseDelim(::syntax::parse::token::Bracket)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Ident(ext_cx.ident_of("fn"),
                                                                                                  ::syntax::parse::token::Plain)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Ident(ext_cx.ident_of("visit"),
                                                                                                  ::syntax::parse::token::Plain)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Lt));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Ident(ext_cx.ident_of("S"),
                                                                                                  ::syntax::parse::token::Plain)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Gt));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::OpenDelim(::syntax::parse::token::Paren)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::BinOp(::syntax::parse::token::And)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Ident(ext_cx.ident_of("mut"),
                                                                                                  ::syntax::parse::token::Plain)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Ident(ext_cx.ident_of("self"),
                                                                                                  ::syntax::parse::token::Plain)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Comma));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Ident(ext_cx.ident_of("serializer"),
                                                                                                  ::syntax::parse::token::Plain)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Colon));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::BinOp(::syntax::parse::token::And)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Ident(ext_cx.ident_of("mut"),
                                                                                                  ::syntax::parse::token::Plain)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Ident(ext_cx.ident_of("S"),
                                                                                                  ::syntax::parse::token::Plain)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::CloseDelim(::syntax::parse::token::Paren)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::RArrow));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Ident(ext_cx.ident_of("Result"),
                                                                                                  ::syntax::parse::token::Plain)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Lt));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Ident(ext_cx.ident_of("Option"),
                                                                                                  ::syntax::parse::token::Plain)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Lt));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::OpenDelim(::syntax::parse::token::Paren)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::CloseDelim(::syntax::parse::token::Paren)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Gt));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Comma));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Ident(ext_cx.ident_of("S"),
                                                                                                  ::syntax::parse::token::ModName)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::ModSep));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Ident(ext_cx.ident_of("Error"),
                                                                                                  ::syntax::parse::token::Plain)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Gt));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Ident(ext_cx.ident_of("where"),
                                                                                                  ::syntax::parse::token::Plain)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Ident(ext_cx.ident_of("S"),
                                                                                                  ::syntax::parse::token::Plain)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Colon));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::ModSep));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Ident(ext_cx.ident_of("serde"),
                                                                                                  ::syntax::parse::token::ModName)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::ModSep));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Ident(ext_cx.ident_of("ser"),
                                                                                                  ::syntax::parse::token::ModName)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::ModSep));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Ident(ext_cx.ident_of("Serializer"),
                                                                                                  ::syntax::parse::token::Plain)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Comma));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::OpenDelim(::syntax::parse::token::Brace)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Ident(ext_cx.ident_of("match"),
                                                                                                  ::syntax::parse::token::Plain)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Ident(ext_cx.ident_of("self"),
                                                                                                  ::syntax::parse::token::Plain)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Dot));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Ident(ext_cx.ident_of("state"),
                                                                                                  ::syntax::parse::token::Plain)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::OpenDelim(::syntax::parse::token::Brace)));
                                     tt.extend(arms.to_tokens(ext_cx).into_iter());
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Underscore));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::FatArrow));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Ident(ext_cx.ident_of("Ok"),
                                                                                                  ::syntax::parse::token::Plain)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::OpenDelim(::syntax::parse::token::Paren)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Ident(ext_cx.ident_of("None"),
                                                                                                  ::syntax::parse::token::Plain)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::CloseDelim(::syntax::parse::token::Paren)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Comma));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::CloseDelim(::syntax::parse::token::Brace)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::CloseDelim(::syntax::parse::token::Brace)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Pound));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::OpenDelim(::syntax::parse::token::Bracket)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Ident(ext_cx.ident_of("inline"),
                                                                                                  ::syntax::parse::token::Plain)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::CloseDelim(::syntax::parse::token::Bracket)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Ident(ext_cx.ident_of("fn"),
                                                                                                  ::syntax::parse::token::Plain)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Ident(ext_cx.ident_of("len"),
                                                                                                  ::syntax::parse::token::Plain)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::OpenDelim(::syntax::parse::token::Paren)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::BinOp(::syntax::parse::token::And)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Ident(ext_cx.ident_of("self"),
                                                                                                  ::syntax::parse::token::Plain)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::CloseDelim(::syntax::parse::token::Paren)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::RArrow));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Ident(ext_cx.ident_of("Option"),
                                                                                                  ::syntax::parse::token::Plain)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Lt));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Ident(ext_cx.ident_of("usize"),
                                                                                                  ::syntax::parse::token::Plain)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Gt));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::OpenDelim(::syntax::parse::token::Brace)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Ident(ext_cx.ident_of("Some"),
                                                                                                  ::syntax::parse::token::Plain)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::OpenDelim(::syntax::parse::token::Paren)));
                                     tt.extend(fields.to_tokens(ext_cx).into_iter());
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::CloseDelim(::syntax::parse::token::Paren)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::CloseDelim(::syntax::parse::token::Brace)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::CloseDelim(::syntax::parse::token::Brace)));
                                     tt
                                 }).parse_item_with_outer_attributes()
         }.unwrap())
    }
    fn serialize_struct_visitor<I>(cx: &ExtCtxt, builder: &aster::AstBuilder,
                                   value_ty: P<ast::Ty>,
                                   struct_def: &StructDef,
                                   generics: &ast::Generics, value_exprs: I)
     -> (P<ast::Item>, P<ast::Item>) where I: Iterator<Item = P<ast::Expr>> {
        let len = struct_def.fields.len();
        let key_exprs = struct_field_strs(cx, builder, struct_def);
        let arms: Vec<ast::Arm> =
            key_exprs.iter().zip(value_exprs).enumerate().map(|(i,
                                                                (key_expr,
                                                                 value_expr))|
                                                                  {
                                                              {
                                                                  #[allow(unused_imports)]
                                                                  use quasi::*;
                                                                  let ext_cx =
                                                                      &*cx;
                                                                  new_parser_from_tts(ext_cx.parse_sess(),
                                                                                      ext_cx.cfg(),
                                                                                      {
                                                                                          let _sp =
                                                                                              ext_cx.call_site();
                                                                                          let mut tt =
                                                                                              ::std::vec::Vec::new();
                                                                                          tt.extend(i.to_tokens(ext_cx).into_iter());
                                                                                          tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                         ::syntax::parse::token::FatArrow));
                                                                                          tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                         ::syntax::parse::token::OpenDelim(::syntax::parse::token::Brace)));
                                                                                          tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                         ::syntax::parse::token::Ident(ext_cx.ident_of("self"),
                                                                                                                                                       ::syntax::parse::token::Plain)));
                                                                                          tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                         ::syntax::parse::token::Dot));
                                                                                          tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                         ::syntax::parse::token::Ident(ext_cx.ident_of("state"),
                                                                                                                                                       ::syntax::parse::token::Plain)));
                                                                                          tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                         ::syntax::parse::token::BinOpEq(::syntax::parse::token::Plus)));
                                                                                          tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                         ::syntax::parse::token::Literal(::syntax::parse::token::Integer(ext_cx.name_of("1")),
                                                                                                                                                         ::std::option::Option::None)));
                                                                                          tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                         ::syntax::parse::token::Semi));
                                                                                          tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                         ::syntax::parse::token::Ident(ext_cx.ident_of("Ok"),
                                                                                                                                                       ::syntax::parse::token::Plain)));
                                                                                          tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                         ::syntax::parse::token::OpenDelim(::syntax::parse::token::Paren)));
                                                                                          tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                         ::syntax::parse::token::Ident(ext_cx.ident_of("Some"),
                                                                                                                                                       ::syntax::parse::token::Plain)));
                                                                                          tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                         ::syntax::parse::token::OpenDelim(::syntax::parse::token::Paren)));
                                                                                          tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                         ::syntax::parse::token::Ident(ext_cx.ident_of("try"),
                                                                                                                                                       ::syntax::parse::token::Plain)));
                                                                                          tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                         ::syntax::parse::token::Not));
                                                                                          tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                         ::syntax::parse::token::OpenDelim(::syntax::parse::token::Paren)));
                                                                                          tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                         ::syntax::parse::token::Ident(ext_cx.ident_of("serializer"),
                                                                                                                                                       ::syntax::parse::token::Plain)));
                                                                                          tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                         ::syntax::parse::token::Dot));
                                                                                          tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                         ::syntax::parse::token::Ident(ext_cx.ident_of("visit_map_elt"),
                                                                                                                                                       ::syntax::parse::token::Plain)));
                                                                                          tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                         ::syntax::parse::token::OpenDelim(::syntax::parse::token::Paren)));
                                                                                          tt.extend(key_expr.to_tokens(ext_cx).into_iter());
                                                                                          tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                         ::syntax::parse::token::Comma));
                                                                                          tt.extend(value_expr.to_tokens(ext_cx).into_iter());
                                                                                          tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                         ::syntax::parse::token::Comma));
                                                                                          tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                         ::syntax::parse::token::CloseDelim(::syntax::parse::token::Paren)));
                                                                                          tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                         ::syntax::parse::token::CloseDelim(::syntax::parse::token::Paren)));
                                                                                          tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                         ::syntax::parse::token::CloseDelim(::syntax::parse::token::Paren)));
                                                                                          tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                         ::syntax::parse::token::CloseDelim(::syntax::parse::token::Paren)));
                                                                                          tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                         ::syntax::parse::token::CloseDelim(::syntax::parse::token::Brace)));
                                                                                          tt
                                                                                      }).parse_arm()
                                                              } }).collect();
        let visitor_impl_generics =
            builder.from_generics(generics.clone()).add_lifetime_bound("\'__a").lifetime_name("\'__a").build();
        let where_clause = &visitor_impl_generics.where_clause;
        let visitor_generics =
            builder.from_generics(visitor_impl_generics.clone()).strip_bounds().build();
        ({
             #[allow(unused_imports)]
             use quasi::*;
             let ext_cx = &*cx;
             new_parser_from_tts(ext_cx.parse_sess(), ext_cx.cfg(),
                                 {
                                     let _sp = ext_cx.call_site();
                                     let mut tt = ::std::vec::Vec::new();
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Ident(ext_cx.ident_of("struct"),
                                                                                                  ::syntax::parse::token::Plain)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Ident(ext_cx.ident_of("Visitor"),
                                                                                                  ::syntax::parse::token::Plain)));
                                     tt.extend(visitor_impl_generics.to_tokens(ext_cx).into_iter());
                                     tt.extend(where_clause.to_tokens(ext_cx).into_iter());
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::OpenDelim(::syntax::parse::token::Brace)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Ident(ext_cx.ident_of("state"),
                                                                                                  ::syntax::parse::token::Plain)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Colon));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Ident(ext_cx.ident_of("usize"),
                                                                                                  ::syntax::parse::token::Plain)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Comma));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Ident(ext_cx.ident_of("value"),
                                                                                                  ::syntax::parse::token::Plain)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Colon));
                                     tt.extend(value_ty.to_tokens(ext_cx).into_iter());
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Comma));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::CloseDelim(::syntax::parse::token::Brace)));
                                     tt
                                 }).parse_item_with_outer_attributes()
         }.unwrap(),
         {
             #[allow(unused_imports)]
             use quasi::*;
             let ext_cx = &*cx;
             new_parser_from_tts(ext_cx.parse_sess(), ext_cx.cfg(),
                                 {
                                     let _sp = ext_cx.call_site();
                                     let mut tt = ::std::vec::Vec::new();
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Ident(ext_cx.ident_of("impl"),
                                                                                                  ::syntax::parse::token::Plain)));
                                     tt.extend(visitor_impl_generics.to_tokens(ext_cx).into_iter());
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::ModSep));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Ident(ext_cx.ident_of("serde"),
                                                                                                  ::syntax::parse::token::ModName)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::ModSep));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Ident(ext_cx.ident_of("ser"),
                                                                                                  ::syntax::parse::token::ModName)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::ModSep));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Ident(ext_cx.ident_of("MapVisitor"),
                                                                                                  ::syntax::parse::token::Plain)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Ident(ext_cx.ident_of("for"),
                                                                                                  ::syntax::parse::token::Plain)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Ident(ext_cx.ident_of("Visitor"),
                                                                                                  ::syntax::parse::token::Plain)));
                                     tt.extend(visitor_generics.to_tokens(ext_cx).into_iter());
                                     tt.extend(where_clause.to_tokens(ext_cx).into_iter());
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::OpenDelim(::syntax::parse::token::Brace)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Pound));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::OpenDelim(::syntax::parse::token::Bracket)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Ident(ext_cx.ident_of("inline"),
                                                                                                  ::syntax::parse::token::Plain)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::CloseDelim(::syntax::parse::token::Bracket)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Ident(ext_cx.ident_of("fn"),
                                                                                                  ::syntax::parse::token::Plain)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Ident(ext_cx.ident_of("visit"),
                                                                                                  ::syntax::parse::token::Plain)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Lt));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Ident(ext_cx.ident_of("S"),
                                                                                                  ::syntax::parse::token::Plain)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Gt));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::OpenDelim(::syntax::parse::token::Paren)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::BinOp(::syntax::parse::token::And)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Ident(ext_cx.ident_of("mut"),
                                                                                                  ::syntax::parse::token::Plain)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Ident(ext_cx.ident_of("self"),
                                                                                                  ::syntax::parse::token::Plain)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Comma));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Ident(ext_cx.ident_of("serializer"),
                                                                                                  ::syntax::parse::token::Plain)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Colon));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::BinOp(::syntax::parse::token::And)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Ident(ext_cx.ident_of("mut"),
                                                                                                  ::syntax::parse::token::Plain)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Ident(ext_cx.ident_of("S"),
                                                                                                  ::syntax::parse::token::Plain)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::CloseDelim(::syntax::parse::token::Paren)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::RArrow));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Ident(ext_cx.ident_of("Result"),
                                                                                                  ::syntax::parse::token::Plain)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Lt));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Ident(ext_cx.ident_of("Option"),
                                                                                                  ::syntax::parse::token::Plain)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Lt));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::OpenDelim(::syntax::parse::token::Paren)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::CloseDelim(::syntax::parse::token::Paren)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Gt));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Comma));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Ident(ext_cx.ident_of("S"),
                                                                                                  ::syntax::parse::token::ModName)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::ModSep));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Ident(ext_cx.ident_of("Error"),
                                                                                                  ::syntax::parse::token::Plain)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Gt));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Ident(ext_cx.ident_of("where"),
                                                                                                  ::syntax::parse::token::Plain)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Ident(ext_cx.ident_of("S"),
                                                                                                  ::syntax::parse::token::Plain)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Colon));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::ModSep));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Ident(ext_cx.ident_of("serde"),
                                                                                                  ::syntax::parse::token::ModName)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::ModSep));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Ident(ext_cx.ident_of("ser"),
                                                                                                  ::syntax::parse::token::ModName)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::ModSep));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Ident(ext_cx.ident_of("Serializer"),
                                                                                                  ::syntax::parse::token::Plain)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Comma));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::OpenDelim(::syntax::parse::token::Brace)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Ident(ext_cx.ident_of("match"),
                                                                                                  ::syntax::parse::token::Plain)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Ident(ext_cx.ident_of("self"),
                                                                                                  ::syntax::parse::token::Plain)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Dot));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Ident(ext_cx.ident_of("state"),
                                                                                                  ::syntax::parse::token::Plain)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::OpenDelim(::syntax::parse::token::Brace)));
                                     tt.extend(arms.to_tokens(ext_cx).into_iter());
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Underscore));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::FatArrow));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Ident(ext_cx.ident_of("Ok"),
                                                                                                  ::syntax::parse::token::Plain)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::OpenDelim(::syntax::parse::token::Paren)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Ident(ext_cx.ident_of("None"),
                                                                                                  ::syntax::parse::token::Plain)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::CloseDelim(::syntax::parse::token::Paren)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Comma));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::CloseDelim(::syntax::parse::token::Brace)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::CloseDelim(::syntax::parse::token::Brace)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Pound));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::OpenDelim(::syntax::parse::token::Bracket)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Ident(ext_cx.ident_of("inline"),
                                                                                                  ::syntax::parse::token::Plain)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::CloseDelim(::syntax::parse::token::Bracket)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Ident(ext_cx.ident_of("fn"),
                                                                                                  ::syntax::parse::token::Plain)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Ident(ext_cx.ident_of("len"),
                                                                                                  ::syntax::parse::token::Plain)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::OpenDelim(::syntax::parse::token::Paren)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::BinOp(::syntax::parse::token::And)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Ident(ext_cx.ident_of("self"),
                                                                                                  ::syntax::parse::token::Plain)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::CloseDelim(::syntax::parse::token::Paren)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::RArrow));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Ident(ext_cx.ident_of("Option"),
                                                                                                  ::syntax::parse::token::Plain)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Lt));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Ident(ext_cx.ident_of("usize"),
                                                                                                  ::syntax::parse::token::Plain)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Gt));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::OpenDelim(::syntax::parse::token::Brace)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::Ident(ext_cx.ident_of("Some"),
                                                                                                  ::syntax::parse::token::Plain)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::OpenDelim(::syntax::parse::token::Paren)));
                                     tt.extend(len.to_tokens(ext_cx).into_iter());
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::CloseDelim(::syntax::parse::token::Paren)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::CloseDelim(::syntax::parse::token::Brace)));
                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                    ::syntax::parse::token::CloseDelim(::syntax::parse::token::Brace)));
                                     tt
                                 }).parse_item_with_outer_attributes()
         }.unwrap())
    }
}
mod de {
    #[prelude_import]
    use std::prelude::v1::*;
    use syntax::ast::{Ident, MetaItem, Item, Expr, StructDef, EnumDef};
    use syntax::ast;
    use syntax::codemap::Span;
    use syntax::ext::base::ExtCtxt;
    use syntax::ext::build::AstBuilder;
    use syntax::ptr::P;
    use aster;
    use field;
    pub fn expand_derive_deserialize(cx: &mut ExtCtxt, span: Span,
                                     _mitem: &MetaItem, item: &Item,
                                     push: &mut FnMut(P<ast::Item>)) {
        let builder = aster::AstBuilder::new().span(span);
        let generics =
            match item.node {
                ast::ItemStruct(_, ref generics) => generics,
                ast::ItemEnum(_, ref generics) => generics,
                _ =>
                cx.bug("expected ItemStruct or ItemEnum in #[derive_deserialize]"),
            };
        let impl_generics =
            builder.from_generics(generics.clone()).add_ty_param_bound(builder.path().global().ids(&["serde",
                                                                                                     "de",
                                                                                                     "Deserialize"]).build()).build();
        let ty =
            builder.ty().path().segment(item.ident).with_generics(impl_generics.clone()).build().build();
        let body =
            deserialize_body(cx, &builder, item, &impl_generics, ty.clone());
        let where_clause = &impl_generics.where_clause;
        let impl_item =
            {
                #[allow(unused_imports)]
                use quasi::*;
                let ext_cx = &*cx;
                new_parser_from_tts(ext_cx.parse_sess(), ext_cx.cfg(),
                                    {
                                        let _sp = ext_cx.call_site();
                                        let mut tt = ::std::vec::Vec::new();
                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                       ::syntax::parse::token::Pound));
                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                       ::syntax::parse::token::OpenDelim(::syntax::parse::token::Bracket)));
                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                       ::syntax::parse::token::Ident(ext_cx.ident_of("automatically_derived"),
                                                                                                     ::syntax::parse::token::Plain)));
                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                       ::syntax::parse::token::CloseDelim(::syntax::parse::token::Bracket)));
                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                       ::syntax::parse::token::Ident(ext_cx.ident_of("impl"),
                                                                                                     ::syntax::parse::token::Plain)));
                                        tt.extend(impl_generics.to_tokens(ext_cx).into_iter());
                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                       ::syntax::parse::token::ModSep));
                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                       ::syntax::parse::token::Ident(ext_cx.ident_of("serde"),
                                                                                                     ::syntax::parse::token::ModName)));
                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                       ::syntax::parse::token::ModSep));
                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                       ::syntax::parse::token::Ident(ext_cx.ident_of("de"),
                                                                                                     ::syntax::parse::token::ModName)));
                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                       ::syntax::parse::token::ModSep));
                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                       ::syntax::parse::token::Ident(ext_cx.ident_of("Deserialize"),
                                                                                                     ::syntax::parse::token::Plain)));
                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                       ::syntax::parse::token::Ident(ext_cx.ident_of("for"),
                                                                                                     ::syntax::parse::token::Plain)));
                                        tt.extend(ty.to_tokens(ext_cx).into_iter());
                                        tt.extend(where_clause.to_tokens(ext_cx).into_iter());
                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                       ::syntax::parse::token::OpenDelim(::syntax::parse::token::Brace)));
                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                       ::syntax::parse::token::Ident(ext_cx.ident_of("fn"),
                                                                                                     ::syntax::parse::token::Plain)));
                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                       ::syntax::parse::token::Ident(ext_cx.ident_of("deserialize"),
                                                                                                     ::syntax::parse::token::Plain)));
                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                       ::syntax::parse::token::Lt));
                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                       ::syntax::parse::token::Ident(ext_cx.ident_of("__D"),
                                                                                                     ::syntax::parse::token::Plain)));
                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                       ::syntax::parse::token::Gt));
                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                       ::syntax::parse::token::OpenDelim(::syntax::parse::token::Paren)));
                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                       ::syntax::parse::token::Ident(ext_cx.ident_of("deserializer"),
                                                                                                     ::syntax::parse::token::Plain)));
                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                       ::syntax::parse::token::Colon));
                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                       ::syntax::parse::token::BinOp(::syntax::parse::token::And)));
                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                       ::syntax::parse::token::Ident(ext_cx.ident_of("mut"),
                                                                                                     ::syntax::parse::token::Plain)));
                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                       ::syntax::parse::token::Ident(ext_cx.ident_of("__D"),
                                                                                                     ::syntax::parse::token::Plain)));
                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                       ::syntax::parse::token::CloseDelim(::syntax::parse::token::Paren)));
                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                       ::syntax::parse::token::RArrow));
                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                       ::syntax::parse::token::Ident(ext_cx.ident_of("Result"),
                                                                                                     ::syntax::parse::token::Plain)));
                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                       ::syntax::parse::token::Lt));
                                        tt.extend(ty.to_tokens(ext_cx).into_iter());
                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                       ::syntax::parse::token::Comma));
                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                       ::syntax::parse::token::Ident(ext_cx.ident_of("__D"),
                                                                                                     ::syntax::parse::token::ModName)));
                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                       ::syntax::parse::token::ModSep));
                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                       ::syntax::parse::token::Ident(ext_cx.ident_of("Error"),
                                                                                                     ::syntax::parse::token::Plain)));
                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                       ::syntax::parse::token::Gt));
                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                       ::syntax::parse::token::Ident(ext_cx.ident_of("where"),
                                                                                                     ::syntax::parse::token::Plain)));
                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                       ::syntax::parse::token::Ident(ext_cx.ident_of("__D"),
                                                                                                     ::syntax::parse::token::Plain)));
                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                       ::syntax::parse::token::Colon));
                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                       ::syntax::parse::token::ModSep));
                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                       ::syntax::parse::token::Ident(ext_cx.ident_of("serde"),
                                                                                                     ::syntax::parse::token::ModName)));
                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                       ::syntax::parse::token::ModSep));
                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                       ::syntax::parse::token::Ident(ext_cx.ident_of("de"),
                                                                                                     ::syntax::parse::token::ModName)));
                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                       ::syntax::parse::token::ModSep));
                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                       ::syntax::parse::token::Ident(ext_cx.ident_of("Deserializer"),
                                                                                                     ::syntax::parse::token::Plain)));
                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                       ::syntax::parse::token::Comma));
                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                       ::syntax::parse::token::OpenDelim(::syntax::parse::token::Brace)));
                                        tt.extend(body.to_tokens(ext_cx).into_iter());
                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                       ::syntax::parse::token::CloseDelim(::syntax::parse::token::Brace)));
                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                       ::syntax::parse::token::CloseDelim(::syntax::parse::token::Brace)));
                                        tt
                                    }).parse_item_with_outer_attributes()
            }.unwrap();
        push(impl_item)
    }
    fn deserialize_body(cx: &ExtCtxt, builder: &aster::AstBuilder,
                        item: &Item, impl_generics: &ast::Generics,
                        ty: P<ast::Ty>) -> P<ast::Expr> {
        match item.node {
            ast::ItemStruct(ref struct_def, _) => {
                deserialize_item_struct(cx, builder, item, impl_generics, ty,
                                        struct_def)
            }
            ast::ItemEnum(ref enum_def, _) => {
                deserialize_item_enum(cx, builder, item.ident, impl_generics,
                                      ty, enum_def)
            }
            _ =>
            cx.bug("expected ItemStruct or ItemEnum in #[derive_deserialize]"),
        }
    }
    fn deserialize_item_struct(cx: &ExtCtxt, builder: &aster::AstBuilder,
                               item: &Item, impl_generics: &ast::Generics,
                               ty: P<ast::Ty>, struct_def: &ast::StructDef)
     -> P<ast::Expr> {
        let mut named_fields =
            <[_] as
                ::std::slice::SliceExt>::into_vec(::std::boxed::Box::new([]));
        let mut unnamed_fields = 0;
        {
            let result =
                match ::std::iter::IntoIterator::into_iter(struct_def.fields.iter())
                    {
                    mut iter =>
                    loop  {
                        match ::std::iter::Iterator::next(&mut iter) {
                            ::std::option::Option::Some(field) => {
                                match field.node.kind {
                                    ast::NamedField(name, _) => {
                                        named_fields.push(name);
                                    }
                                    ast::UnnamedField(_) => {
                                        unnamed_fields += 1;
                                    }
                                }
                            }
                            ::std::option::Option::None => break ,
                        }
                    },
                };
            result
        }
        match (named_fields.is_empty(), unnamed_fields == 0) {
            (true, true) => {
                deserialize_unit_struct(cx, &builder, item.ident)
            }
            (true, false) => {
                deserialize_tuple_struct(cx, &builder, item.ident,
                                         impl_generics, ty, unnamed_fields)
            }
            (false, true) => {
                deserialize_struct(cx, &builder, item.ident, impl_generics,
                                   ty, struct_def)
            }
            (false, false) => {
                cx.bug("struct has named and unnamed fields")
            }
        }
    }
    fn deserialize_visitor(builder: &aster::AstBuilder,
                           trait_generics: &ast::Generics)
     -> (P<ast::Item>, P<ast::Ty>, P<ast::Expr>) {
        if trait_generics.ty_params.is_empty() {
            (builder.item().tuple_struct("__Visitor").build(),
             builder.ty().id("__Visitor"), builder.expr().id("__Visitor"))
        } else {
            (builder.item().tuple_struct("__Visitor").generics().with(trait_generics.clone()).build().with_tys(trait_generics.ty_params.iter().map(|ty_param|
                                                                                                                                                       {
                                                                                                                                                   builder.ty().phantom_data().id(ty_param.ident)
                                                                                                                                               })).build(),
             builder.ty().path().segment("__Visitor").with_generics(trait_generics.clone()).build().build(),
             builder.expr().call().id("__Visitor").with_args(trait_generics.ty_params.iter().map(|_|
                                                                                                     {
                                                                                                 builder.expr().phantom_data()
                                                                                             })).build())
        }
    }
    fn deserialize_unit_struct(cx: &ExtCtxt, builder: &aster::AstBuilder,
                               type_ident: Ident) -> P<ast::Expr> {
        let type_name = builder.expr().str(type_ident);
        {
            #[allow(unused_imports)]
            use quasi::*;
            let ext_cx = &*cx;
            new_parser_from_tts(ext_cx.parse_sess(), ext_cx.cfg(),
                                {
                                    let _sp = ext_cx.call_site();
                                    let mut tt = ::std::vec::Vec::new();
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::OpenDelim(::syntax::parse::token::Brace)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("struct"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("__Visitor"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Semi));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("impl"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::ModSep));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("serde"),
                                                                                                 ::syntax::parse::token::ModName)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::ModSep));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("de"),
                                                                                                 ::syntax::parse::token::ModName)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::ModSep));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("Visitor"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("for"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("__Visitor"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::OpenDelim(::syntax::parse::token::Brace)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("type"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("Value"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Eq));
                                    tt.extend(type_ident.to_tokens(ext_cx).into_iter());
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Semi));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Pound));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::OpenDelim(::syntax::parse::token::Bracket)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("inline"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::CloseDelim(::syntax::parse::token::Bracket)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("fn"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("visit_unit"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Lt));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("E"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Gt));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::OpenDelim(::syntax::parse::token::Paren)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::BinOp(::syntax::parse::token::And)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("mut"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("self"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::CloseDelim(::syntax::parse::token::Paren)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::RArrow));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("Result"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Lt));
                                    tt.extend(type_ident.to_tokens(ext_cx).into_iter());
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Comma));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("E"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Gt));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("where"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("E"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Colon));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::ModSep));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("serde"),
                                                                                                 ::syntax::parse::token::ModName)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::ModSep));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("de"),
                                                                                                 ::syntax::parse::token::ModName)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::ModSep));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("Error"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Comma));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::OpenDelim(::syntax::parse::token::Brace)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("Ok"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::OpenDelim(::syntax::parse::token::Paren)));
                                    tt.extend(type_ident.to_tokens(ext_cx).into_iter());
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::CloseDelim(::syntax::parse::token::Paren)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::CloseDelim(::syntax::parse::token::Brace)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Pound));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::OpenDelim(::syntax::parse::token::Bracket)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("inline"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::CloseDelim(::syntax::parse::token::Bracket)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("fn"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("visit_named_unit"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Lt));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("E"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Colon));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::ModSep));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("serde"),
                                                                                                 ::syntax::parse::token::ModName)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::ModSep));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("de"),
                                                                                                 ::syntax::parse::token::ModName)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::ModSep));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("Error"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Comma));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Gt));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::OpenDelim(::syntax::parse::token::Paren)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::BinOp(::syntax::parse::token::And)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("mut"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("self"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Comma));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("name"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Colon));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::BinOp(::syntax::parse::token::And)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("str"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::CloseDelim(::syntax::parse::token::Paren)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::RArrow));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("Result"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Lt));
                                    tt.extend(type_ident.to_tokens(ext_cx).into_iter());
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Comma));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("E"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Gt));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::OpenDelim(::syntax::parse::token::Brace)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("if"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("name"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::EqEq));
                                    tt.extend(type_name.to_tokens(ext_cx).into_iter());
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::OpenDelim(::syntax::parse::token::Brace)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("self"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Dot));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("visit_unit"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::OpenDelim(::syntax::parse::token::Paren)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::CloseDelim(::syntax::parse::token::Paren)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::CloseDelim(::syntax::parse::token::Brace)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("else"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::OpenDelim(::syntax::parse::token::Brace)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("Err"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::OpenDelim(::syntax::parse::token::Paren)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::ModSep));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("serde"),
                                                                                                 ::syntax::parse::token::ModName)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::ModSep));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("de"),
                                                                                                 ::syntax::parse::token::ModName)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::ModSep));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("Error"),
                                                                                                 ::syntax::parse::token::ModName)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::ModSep));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("syntax_error"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::OpenDelim(::syntax::parse::token::Paren)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::CloseDelim(::syntax::parse::token::Paren)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::CloseDelim(::syntax::parse::token::Paren)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::CloseDelim(::syntax::parse::token::Brace)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::CloseDelim(::syntax::parse::token::Brace)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Pound));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::OpenDelim(::syntax::parse::token::Bracket)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("inline"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::CloseDelim(::syntax::parse::token::Bracket)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("fn"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("visit_seq"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Lt));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("V"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Gt));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::OpenDelim(::syntax::parse::token::Paren)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::BinOp(::syntax::parse::token::And)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("mut"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("self"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Comma));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("mut"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("visitor"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Colon));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("V"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::CloseDelim(::syntax::parse::token::Paren)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::RArrow));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("Result"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Lt));
                                    tt.extend(type_ident.to_tokens(ext_cx).into_iter());
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Comma));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("V"),
                                                                                                 ::syntax::parse::token::ModName)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::ModSep));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("Error"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Gt));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("where"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("V"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Colon));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::ModSep));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("serde"),
                                                                                                 ::syntax::parse::token::ModName)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::ModSep));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("de"),
                                                                                                 ::syntax::parse::token::ModName)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::ModSep));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("SeqVisitor"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Comma));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::OpenDelim(::syntax::parse::token::Brace)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("try"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Not));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::OpenDelim(::syntax::parse::token::Paren)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("visitor"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Dot));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("end"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::OpenDelim(::syntax::parse::token::Paren)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::CloseDelim(::syntax::parse::token::Paren)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::CloseDelim(::syntax::parse::token::Paren)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Semi));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("self"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Dot));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("visit_unit"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::OpenDelim(::syntax::parse::token::Paren)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::CloseDelim(::syntax::parse::token::Paren)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::CloseDelim(::syntax::parse::token::Brace)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::CloseDelim(::syntax::parse::token::Brace)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("deserializer"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Dot));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("visit"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::OpenDelim(::syntax::parse::token::Paren)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("__Visitor"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::CloseDelim(::syntax::parse::token::Paren)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::CloseDelim(::syntax::parse::token::Brace)));
                                    tt
                                }).parse_expr()
        }
    }
    fn deserialize_tuple_struct(cx: &ExtCtxt, builder: &aster::AstBuilder,
                                type_ident: Ident,
                                impl_generics: &ast::Generics, ty: P<ast::Ty>,
                                fields: usize) -> P<ast::Expr> {
        let where_clause = &impl_generics.where_clause;
        let (visitor_item, visitor_ty, visitor_expr) =
            deserialize_visitor(builder, impl_generics);
        let visit_seq_expr =
            deserialize_seq(cx, builder,
                            builder.path().id(type_ident).build(), fields);
        let type_name = builder.expr().str(type_ident);
        {
            #[allow(unused_imports)]
            use quasi::*;
            let ext_cx = &*cx;
            new_parser_from_tts(ext_cx.parse_sess(), ext_cx.cfg(),
                                {
                                    let _sp = ext_cx.call_site();
                                    let mut tt = ::std::vec::Vec::new();
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::OpenDelim(::syntax::parse::token::Brace)));
                                    tt.extend(visitor_item.to_tokens(ext_cx).into_iter());
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("impl"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.extend(impl_generics.to_tokens(ext_cx).into_iter());
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::ModSep));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("serde"),
                                                                                                 ::syntax::parse::token::ModName)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::ModSep));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("de"),
                                                                                                 ::syntax::parse::token::ModName)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::ModSep));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("Visitor"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("for"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.extend(visitor_ty.to_tokens(ext_cx).into_iter());
                                    tt.extend(where_clause.to_tokens(ext_cx).into_iter());
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::OpenDelim(::syntax::parse::token::Brace)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("type"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("Value"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Eq));
                                    tt.extend(ty.to_tokens(ext_cx).into_iter());
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Semi));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("fn"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("visit_seq"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Lt));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("__V"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Gt));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::OpenDelim(::syntax::parse::token::Paren)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::BinOp(::syntax::parse::token::And)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("mut"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("self"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Comma));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("mut"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("visitor"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Colon));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("__V"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::CloseDelim(::syntax::parse::token::Paren)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::RArrow));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("Result"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Lt));
                                    tt.extend(ty.to_tokens(ext_cx).into_iter());
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Comma));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("__V"),
                                                                                                 ::syntax::parse::token::ModName)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::ModSep));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("Error"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Gt));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("where"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("__V"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Colon));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::ModSep));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("serde"),
                                                                                                 ::syntax::parse::token::ModName)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::ModSep));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("de"),
                                                                                                 ::syntax::parse::token::ModName)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::ModSep));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("SeqVisitor"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Comma));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::OpenDelim(::syntax::parse::token::Brace)));
                                    tt.extend(visit_seq_expr.to_tokens(ext_cx).into_iter());
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::CloseDelim(::syntax::parse::token::Brace)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("fn"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("visit_named_seq"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Lt));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("__V"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Gt));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::OpenDelim(::syntax::parse::token::Paren)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::BinOp(::syntax::parse::token::And)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("mut"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("self"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Comma));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("name"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Colon));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::BinOp(::syntax::parse::token::And)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("str"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Comma));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("visitor"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Colon));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("__V"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::CloseDelim(::syntax::parse::token::Paren)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::RArrow));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("Result"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Lt));
                                    tt.extend(ty.to_tokens(ext_cx).into_iter());
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Comma));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("__V"),
                                                                                                 ::syntax::parse::token::ModName)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::ModSep));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("Error"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Gt));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("where"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("__V"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Colon));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::ModSep));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("serde"),
                                                                                                 ::syntax::parse::token::ModName)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::ModSep));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("de"),
                                                                                                 ::syntax::parse::token::ModName)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::ModSep));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("SeqVisitor"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Comma));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::OpenDelim(::syntax::parse::token::Brace)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("if"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("name"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::EqEq));
                                    tt.extend(type_name.to_tokens(ext_cx).into_iter());
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::OpenDelim(::syntax::parse::token::Brace)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("self"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Dot));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("visit_seq"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::OpenDelim(::syntax::parse::token::Paren)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("visitor"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::CloseDelim(::syntax::parse::token::Paren)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::CloseDelim(::syntax::parse::token::Brace)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("else"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::OpenDelim(::syntax::parse::token::Brace)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("Err"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::OpenDelim(::syntax::parse::token::Paren)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::ModSep));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("serde"),
                                                                                                 ::syntax::parse::token::ModName)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::ModSep));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("de"),
                                                                                                 ::syntax::parse::token::ModName)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::ModSep));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("Error"),
                                                                                                 ::syntax::parse::token::ModName)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::ModSep));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("syntax_error"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::OpenDelim(::syntax::parse::token::Paren)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::CloseDelim(::syntax::parse::token::Paren)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::CloseDelim(::syntax::parse::token::Paren)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::CloseDelim(::syntax::parse::token::Brace)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::CloseDelim(::syntax::parse::token::Brace)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::CloseDelim(::syntax::parse::token::Brace)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("deserializer"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Dot));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("visit"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::OpenDelim(::syntax::parse::token::Paren)));
                                    tt.extend(visitor_expr.to_tokens(ext_cx).into_iter());
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::CloseDelim(::syntax::parse::token::Paren)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::CloseDelim(::syntax::parse::token::Brace)));
                                    tt
                                }).parse_expr()
        }
    }
    fn deserialize_seq(cx: &ExtCtxt, builder: &aster::AstBuilder,
                       struct_path: ast::Path, fields: usize)
     -> P<ast::Expr> {
        let let_values: Vec<P<_>> =
            (0..fields).map(|i| {
                            let name =
                                builder.id(::std::fmt::format(::std::fmt::Arguments::new_v1({
                                                                                                static __STATIC_FMTSTR:
                                                                                                       &'static [&'static str]
                                                                                                       =
                                                                                                    &["__field"];
                                                                                                __STATIC_FMTSTR
                                                                                            },
                                                                                            &match (&i,)
                                                                                                 {
                                                                                                 (__arg0,)
                                                                                                 =>
                                                                                                 [::std::fmt::ArgumentV1::new(__arg0,
                                                                                                                              ::std::fmt::Display::fmt)],
                                                                                             })));
                            {
                                #[allow(unused_imports)]
                                use quasi::*;
                                let ext_cx = &*cx;
                                new_parser_from_tts(ext_cx.parse_sess(),
                                                    ext_cx.cfg(),
                                                    {
                                                        let _sp =
                                                            ext_cx.call_site();
                                                        let mut tt =
                                                            ::std::vec::Vec::new();
                                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                                       ::syntax::parse::token::Ident(ext_cx.ident_of("let"),
                                                                                                                     ::syntax::parse::token::Plain)));
                                                        tt.extend(name.to_tokens(ext_cx).into_iter());
                                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                                       ::syntax::parse::token::Eq));
                                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                                       ::syntax::parse::token::Ident(ext_cx.ident_of("match"),
                                                                                                                     ::syntax::parse::token::Plain)));
                                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                                       ::syntax::parse::token::Ident(ext_cx.ident_of("try"),
                                                                                                                     ::syntax::parse::token::Plain)));
                                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                                       ::syntax::parse::token::Not));
                                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                                       ::syntax::parse::token::OpenDelim(::syntax::parse::token::Paren)));
                                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                                       ::syntax::parse::token::Ident(ext_cx.ident_of("visitor"),
                                                                                                                     ::syntax::parse::token::Plain)));
                                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                                       ::syntax::parse::token::Dot));
                                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                                       ::syntax::parse::token::Ident(ext_cx.ident_of("visit"),
                                                                                                                     ::syntax::parse::token::Plain)));
                                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                                       ::syntax::parse::token::OpenDelim(::syntax::parse::token::Paren)));
                                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                                       ::syntax::parse::token::CloseDelim(::syntax::parse::token::Paren)));
                                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                                       ::syntax::parse::token::CloseDelim(::syntax::parse::token::Paren)));
                                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                                       ::syntax::parse::token::OpenDelim(::syntax::parse::token::Brace)));
                                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                                       ::syntax::parse::token::Ident(ext_cx.ident_of("Some"),
                                                                                                                     ::syntax::parse::token::Plain)));
                                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                                       ::syntax::parse::token::OpenDelim(::syntax::parse::token::Paren)));
                                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                                       ::syntax::parse::token::Ident(ext_cx.ident_of("value"),
                                                                                                                     ::syntax::parse::token::Plain)));
                                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                                       ::syntax::parse::token::CloseDelim(::syntax::parse::token::Paren)));
                                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                                       ::syntax::parse::token::FatArrow));
                                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                                       ::syntax::parse::token::Ident(ext_cx.ident_of("value"),
                                                                                                                     ::syntax::parse::token::Plain)));
                                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                                       ::syntax::parse::token::Comma));
                                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                                       ::syntax::parse::token::Ident(ext_cx.ident_of("None"),
                                                                                                                     ::syntax::parse::token::Plain)));
                                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                                       ::syntax::parse::token::FatArrow));
                                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                                       ::syntax::parse::token::OpenDelim(::syntax::parse::token::Brace)));
                                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                                       ::syntax::parse::token::Ident(ext_cx.ident_of("return"),
                                                                                                                     ::syntax::parse::token::Plain)));
                                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                                       ::syntax::parse::token::Ident(ext_cx.ident_of("Err"),
                                                                                                                     ::syntax::parse::token::Plain)));
                                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                                       ::syntax::parse::token::OpenDelim(::syntax::parse::token::Paren)));
                                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                                       ::syntax::parse::token::ModSep));
                                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                                       ::syntax::parse::token::Ident(ext_cx.ident_of("serde"),
                                                                                                                     ::syntax::parse::token::ModName)));
                                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                                       ::syntax::parse::token::ModSep));
                                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                                       ::syntax::parse::token::Ident(ext_cx.ident_of("de"),
                                                                                                                     ::syntax::parse::token::ModName)));
                                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                                       ::syntax::parse::token::ModSep));
                                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                                       ::syntax::parse::token::Ident(ext_cx.ident_of("Error"),
                                                                                                                     ::syntax::parse::token::ModName)));
                                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                                       ::syntax::parse::token::ModSep));
                                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                                       ::syntax::parse::token::Ident(ext_cx.ident_of("end_of_stream_error"),
                                                                                                                     ::syntax::parse::token::Plain)));
                                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                                       ::syntax::parse::token::OpenDelim(::syntax::parse::token::Paren)));
                                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                                       ::syntax::parse::token::CloseDelim(::syntax::parse::token::Paren)));
                                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                                       ::syntax::parse::token::CloseDelim(::syntax::parse::token::Paren)));
                                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                                       ::syntax::parse::token::Semi));
                                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                                       ::syntax::parse::token::CloseDelim(::syntax::parse::token::Brace)));
                                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                                       ::syntax::parse::token::CloseDelim(::syntax::parse::token::Brace)));
                                                        tt.push(::syntax::ast::TtToken(_sp,
                                                                                       ::syntax::parse::token::Semi));
                                                        tt
                                                    }).parse_stmt(::std::vec::Vec::new())
                            } }).collect();
        let result =
            builder.expr().call().build_path(struct_path).with_args((0..fields).map(|i|
                                                                                        builder.expr().id(::std::fmt::format(::std::fmt::Arguments::new_v1({
                                                                                                                                                               static __STATIC_FMTSTR:
                                                                                                                                                                      &'static [&'static str]
                                                                                                                                                                      =
                                                                                                                                                                   &["__field"];
                                                                                                                                                               __STATIC_FMTSTR
                                                                                                                                                           },
                                                                                                                                                           &match (&i,)
                                                                                                                                                                {
                                                                                                                                                                (__arg0,)
                                                                                                                                                                =>
                                                                                                                                                                [::std::fmt::ArgumentV1::new(__arg0,
                                                                                                                                                                                             ::std::fmt::Display::fmt)],
                                                                                                                                                            }))))).build();
        {
            #[allow(unused_imports)]
            use quasi::*;
            let ext_cx = &*cx;
            new_parser_from_tts(ext_cx.parse_sess(), ext_cx.cfg(),
                                {
                                    let _sp = ext_cx.call_site();
                                    let mut tt = ::std::vec::Vec::new();
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::OpenDelim(::syntax::parse::token::Brace)));
                                    tt.extend(let_values.to_tokens(ext_cx).into_iter());
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("try"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Not));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::OpenDelim(::syntax::parse::token::Paren)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("visitor"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Dot));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("end"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::OpenDelim(::syntax::parse::token::Paren)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::CloseDelim(::syntax::parse::token::Paren)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::CloseDelim(::syntax::parse::token::Paren)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Semi));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("Ok"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::OpenDelim(::syntax::parse::token::Paren)));
                                    tt.extend(result.to_tokens(ext_cx).into_iter());
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::CloseDelim(::syntax::parse::token::Paren)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::CloseDelim(::syntax::parse::token::Brace)));
                                    tt
                                }).parse_expr()
        }
    }
    fn deserialize_struct(cx: &ExtCtxt, builder: &aster::AstBuilder,
                          type_ident: Ident, impl_generics: &ast::Generics,
                          ty: P<ast::Ty>, struct_def: &StructDef)
     -> P<ast::Expr> {
        let where_clause = &impl_generics.where_clause;
        let (visitor_item, visitor_ty, visitor_expr) =
            deserialize_visitor(builder, impl_generics);
        let (field_visitor, visit_map_expr) =
            deserialize_struct_visitor(cx, builder, struct_def,
                                       builder.path().id(type_ident).build());
        let type_name = builder.expr().str(type_ident);
        {
            #[allow(unused_imports)]
            use quasi::*;
            let ext_cx = &*cx;
            new_parser_from_tts(ext_cx.parse_sess(), ext_cx.cfg(),
                                {
                                    let _sp = ext_cx.call_site();
                                    let mut tt = ::std::vec::Vec::new();
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::OpenDelim(::syntax::parse::token::Brace)));
                                    tt.extend(field_visitor.to_tokens(ext_cx).into_iter());
                                    tt.extend(visitor_item.to_tokens(ext_cx).into_iter());
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("impl"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.extend(impl_generics.to_tokens(ext_cx).into_iter());
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::ModSep));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("serde"),
                                                                                                 ::syntax::parse::token::ModName)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::ModSep));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("de"),
                                                                                                 ::syntax::parse::token::ModName)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::ModSep));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("Visitor"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("for"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.extend(visitor_ty.to_tokens(ext_cx).into_iter());
                                    tt.extend(where_clause.to_tokens(ext_cx).into_iter());
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::OpenDelim(::syntax::parse::token::Brace)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("type"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("Value"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Eq));
                                    tt.extend(ty.to_tokens(ext_cx).into_iter());
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Semi));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Pound));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::OpenDelim(::syntax::parse::token::Bracket)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("inline"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::CloseDelim(::syntax::parse::token::Bracket)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("fn"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("visit_map"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Lt));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("__V"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Gt));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::OpenDelim(::syntax::parse::token::Paren)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::BinOp(::syntax::parse::token::And)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("mut"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("self"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Comma));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("mut"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("visitor"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Colon));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("__V"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::CloseDelim(::syntax::parse::token::Paren)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::RArrow));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("Result"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Lt));
                                    tt.extend(ty.to_tokens(ext_cx).into_iter());
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Comma));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("__V"),
                                                                                                 ::syntax::parse::token::ModName)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::ModSep));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("Error"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Gt));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("where"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("__V"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Colon));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::ModSep));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("serde"),
                                                                                                 ::syntax::parse::token::ModName)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::ModSep));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("de"),
                                                                                                 ::syntax::parse::token::ModName)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::ModSep));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("MapVisitor"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Comma));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::OpenDelim(::syntax::parse::token::Brace)));
                                    tt.extend(visit_map_expr.to_tokens(ext_cx).into_iter());
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::CloseDelim(::syntax::parse::token::Brace)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Pound));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::OpenDelim(::syntax::parse::token::Bracket)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("inline"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::CloseDelim(::syntax::parse::token::Bracket)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("fn"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("visit_named_map"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Lt));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("__V"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Gt));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::OpenDelim(::syntax::parse::token::Paren)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::BinOp(::syntax::parse::token::And)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("mut"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("self"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Comma));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("name"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Colon));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::BinOp(::syntax::parse::token::And)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("str"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Comma));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("visitor"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Colon));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("__V"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::CloseDelim(::syntax::parse::token::Paren)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::RArrow));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("Result"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Lt));
                                    tt.extend(ty.to_tokens(ext_cx).into_iter());
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Comma));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("__V"),
                                                                                                 ::syntax::parse::token::ModName)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::ModSep));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("Error"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Gt));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("where"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("__V"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Colon));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::ModSep));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("serde"),
                                                                                                 ::syntax::parse::token::ModName)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::ModSep));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("de"),
                                                                                                 ::syntax::parse::token::ModName)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::ModSep));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("MapVisitor"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Comma));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::OpenDelim(::syntax::parse::token::Brace)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("if"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("name"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::EqEq));
                                    tt.extend(type_name.to_tokens(ext_cx).into_iter());
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::OpenDelim(::syntax::parse::token::Brace)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("self"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Dot));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("visit_map"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::OpenDelim(::syntax::parse::token::Paren)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("visitor"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::CloseDelim(::syntax::parse::token::Paren)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::CloseDelim(::syntax::parse::token::Brace)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("else"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::OpenDelim(::syntax::parse::token::Brace)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("Err"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::OpenDelim(::syntax::parse::token::Paren)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::ModSep));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("serde"),
                                                                                                 ::syntax::parse::token::ModName)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::ModSep));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("de"),
                                                                                                 ::syntax::parse::token::ModName)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::ModSep));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("Error"),
                                                                                                 ::syntax::parse::token::ModName)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::ModSep));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("syntax_error"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::OpenDelim(::syntax::parse::token::Paren)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::CloseDelim(::syntax::parse::token::Paren)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::CloseDelim(::syntax::parse::token::Paren)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::CloseDelim(::syntax::parse::token::Brace)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::CloseDelim(::syntax::parse::token::Brace)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::CloseDelim(::syntax::parse::token::Brace)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("deserializer"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Dot));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("visit"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::OpenDelim(::syntax::parse::token::Paren)));
                                    tt.extend(visitor_expr.to_tokens(ext_cx).into_iter());
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::CloseDelim(::syntax::parse::token::Paren)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::CloseDelim(::syntax::parse::token::Brace)));
                                    tt
                                }).parse_expr()
        }
    }
    fn deserialize_item_enum(cx: &ExtCtxt, builder: &aster::AstBuilder,
                             type_ident: Ident, impl_generics: &ast::Generics,
                             ty: P<ast::Ty>, enum_def: &EnumDef)
     -> P<ast::Expr> {
        let where_clause = &impl_generics.where_clause;
        let type_name = builder.expr().str(type_ident);
        let variant_arms: Vec<_> =
            enum_def.variants.iter().map(|variant| {
                                         deserialize_variant(cx, builder,
                                                             type_ident,
                                                             impl_generics,
                                                             ty.clone(),
                                                             variant)
                                     }).collect();
        let (visitor_item, visitor_ty, visitor_expr) =
            deserialize_visitor(builder, impl_generics);
        {
            #[allow(unused_imports)]
            use quasi::*;
            let ext_cx = &*cx;
            new_parser_from_tts(ext_cx.parse_sess(), ext_cx.cfg(),
                                {
                                    let _sp = ext_cx.call_site();
                                    let mut tt = ::std::vec::Vec::new();
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::OpenDelim(::syntax::parse::token::Brace)));
                                    tt.extend(visitor_item.to_tokens(ext_cx).into_iter());
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("impl"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.extend(impl_generics.to_tokens(ext_cx).into_iter());
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::ModSep));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("serde"),
                                                                                                 ::syntax::parse::token::ModName)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::ModSep));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("de"),
                                                                                                 ::syntax::parse::token::ModName)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::ModSep));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("Visitor"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("for"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.extend(visitor_ty.to_tokens(ext_cx).into_iter());
                                    tt.extend(where_clause.to_tokens(ext_cx).into_iter());
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::OpenDelim(::syntax::parse::token::Brace)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("type"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("Value"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Eq));
                                    tt.extend(ty.to_tokens(ext_cx).into_iter());
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Semi));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("fn"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("visit_enum"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Lt));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("__V"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Gt));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::OpenDelim(::syntax::parse::token::Paren)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::BinOp(::syntax::parse::token::And)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("mut"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("self"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Comma));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("name"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Colon));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::BinOp(::syntax::parse::token::And)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("str"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Comma));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("variant"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Colon));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::BinOp(::syntax::parse::token::And)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("str"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Comma));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("visitor"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Colon));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("__V"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::CloseDelim(::syntax::parse::token::Paren)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::RArrow));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("Result"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Lt));
                                    tt.extend(ty.to_tokens(ext_cx).into_iter());
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Comma));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("__V"),
                                                                                                 ::syntax::parse::token::ModName)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::ModSep));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("Error"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Gt));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("where"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("__V"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Colon));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::ModSep));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("serde"),
                                                                                                 ::syntax::parse::token::ModName)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::ModSep));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("de"),
                                                                                                 ::syntax::parse::token::ModName)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::ModSep));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("EnumVisitor"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Comma));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::OpenDelim(::syntax::parse::token::Brace)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("if"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("name"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::EqEq));
                                    tt.extend(type_name.to_tokens(ext_cx).into_iter());
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::OpenDelim(::syntax::parse::token::Brace)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("self"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Dot));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("visit_variant"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::OpenDelim(::syntax::parse::token::Paren)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("variant"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Comma));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("visitor"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::CloseDelim(::syntax::parse::token::Paren)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::CloseDelim(::syntax::parse::token::Brace)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("else"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::OpenDelim(::syntax::parse::token::Brace)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("Err"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::OpenDelim(::syntax::parse::token::Paren)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::ModSep));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("serde"),
                                                                                                 ::syntax::parse::token::ModName)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::ModSep));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("de"),
                                                                                                 ::syntax::parse::token::ModName)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::ModSep));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("Error"),
                                                                                                 ::syntax::parse::token::ModName)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::ModSep));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("syntax_error"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::OpenDelim(::syntax::parse::token::Paren)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::CloseDelim(::syntax::parse::token::Paren)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::CloseDelim(::syntax::parse::token::Paren)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::CloseDelim(::syntax::parse::token::Brace)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::CloseDelim(::syntax::parse::token::Brace)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("fn"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("visit_variant"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Lt));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("__V"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Gt));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::OpenDelim(::syntax::parse::token::Paren)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::BinOp(::syntax::parse::token::And)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("mut"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("self"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Comma));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("name"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Colon));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::BinOp(::syntax::parse::token::And)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("str"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Comma));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("mut"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("visitor"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Colon));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("__V"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::CloseDelim(::syntax::parse::token::Paren)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::RArrow));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("Result"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Lt));
                                    tt.extend(ty.to_tokens(ext_cx).into_iter());
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Comma));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("__V"),
                                                                                                 ::syntax::parse::token::ModName)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::ModSep));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("Error"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Gt));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("where"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("__V"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Colon));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::ModSep));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("serde"),
                                                                                                 ::syntax::parse::token::ModName)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::ModSep));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("de"),
                                                                                                 ::syntax::parse::token::ModName)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::ModSep));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("EnumVisitor"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::OpenDelim(::syntax::parse::token::Brace)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("match"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("name"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::OpenDelim(::syntax::parse::token::Brace)));
                                    tt.extend(variant_arms.to_tokens(ext_cx).into_iter());
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Underscore));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::FatArrow));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("Err"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::OpenDelim(::syntax::parse::token::Paren)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::ModSep));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("serde"),
                                                                                                 ::syntax::parse::token::ModName)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::ModSep));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("de"),
                                                                                                 ::syntax::parse::token::ModName)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::ModSep));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("Error"),
                                                                                                 ::syntax::parse::token::ModName)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::ModSep));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("syntax_error"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::OpenDelim(::syntax::parse::token::Paren)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::CloseDelim(::syntax::parse::token::Paren)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::CloseDelim(::syntax::parse::token::Paren)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Comma));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::CloseDelim(::syntax::parse::token::Brace)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::CloseDelim(::syntax::parse::token::Brace)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::CloseDelim(::syntax::parse::token::Brace)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("deserializer"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Dot));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("visit_enum"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::OpenDelim(::syntax::parse::token::Paren)));
                                    tt.extend(visitor_expr.to_tokens(ext_cx).into_iter());
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::CloseDelim(::syntax::parse::token::Paren)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::CloseDelim(::syntax::parse::token::Brace)));
                                    tt
                                }).parse_expr()
        }
    }
    fn deserialize_variant(cx: &ExtCtxt, builder: &aster::AstBuilder,
                           type_ident: Ident, generics: &ast::Generics,
                           ty: P<ast::Ty>, variant: &ast::Variant)
     -> ast::Arm {
        let variant_ident = variant.node.name;
        let variant_name = builder.expr().str(variant_ident);
        match variant.node.kind {
            ast::TupleVariantKind(ref args) if args.is_empty() => {
                {
                    #[allow(unused_imports)]
                    use quasi::*;
                    let ext_cx = &*cx;
                    new_parser_from_tts(ext_cx.parse_sess(), ext_cx.cfg(),
                                        {
                                            let _sp = ext_cx.call_site();
                                            let mut tt =
                                                ::std::vec::Vec::new();
                                            tt.extend(variant_name.to_tokens(ext_cx).into_iter());
                                            tt.push(::syntax::ast::TtToken(_sp,
                                                                           ::syntax::parse::token::FatArrow));
                                            tt.push(::syntax::ast::TtToken(_sp,
                                                                           ::syntax::parse::token::OpenDelim(::syntax::parse::token::Brace)));
                                            tt.push(::syntax::ast::TtToken(_sp,
                                                                           ::syntax::parse::token::Ident(ext_cx.ident_of("try"),
                                                                                                         ::syntax::parse::token::Plain)));
                                            tt.push(::syntax::ast::TtToken(_sp,
                                                                           ::syntax::parse::token::Not));
                                            tt.push(::syntax::ast::TtToken(_sp,
                                                                           ::syntax::parse::token::OpenDelim(::syntax::parse::token::Paren)));
                                            tt.push(::syntax::ast::TtToken(_sp,
                                                                           ::syntax::parse::token::Ident(ext_cx.ident_of("visitor"),
                                                                                                         ::syntax::parse::token::Plain)));
                                            tt.push(::syntax::ast::TtToken(_sp,
                                                                           ::syntax::parse::token::Dot));
                                            tt.push(::syntax::ast::TtToken(_sp,
                                                                           ::syntax::parse::token::Ident(ext_cx.ident_of("visit_unit"),
                                                                                                         ::syntax::parse::token::Plain)));
                                            tt.push(::syntax::ast::TtToken(_sp,
                                                                           ::syntax::parse::token::OpenDelim(::syntax::parse::token::Paren)));
                                            tt.push(::syntax::ast::TtToken(_sp,
                                                                           ::syntax::parse::token::CloseDelim(::syntax::parse::token::Paren)));
                                            tt.push(::syntax::ast::TtToken(_sp,
                                                                           ::syntax::parse::token::CloseDelim(::syntax::parse::token::Paren)));
                                            tt.push(::syntax::ast::TtToken(_sp,
                                                                           ::syntax::parse::token::Semi));
                                            tt.push(::syntax::ast::TtToken(_sp,
                                                                           ::syntax::parse::token::Ident(ext_cx.ident_of("Ok"),
                                                                                                         ::syntax::parse::token::Plain)));
                                            tt.push(::syntax::ast::TtToken(_sp,
                                                                           ::syntax::parse::token::OpenDelim(::syntax::parse::token::Paren)));
                                            tt.extend(type_ident.to_tokens(ext_cx).into_iter());
                                            tt.push(::syntax::ast::TtToken(_sp,
                                                                           ::syntax::parse::token::ModSep));
                                            tt.extend(variant_ident.to_tokens(ext_cx).into_iter());
                                            tt.push(::syntax::ast::TtToken(_sp,
                                                                           ::syntax::parse::token::CloseDelim(::syntax::parse::token::Paren)));
                                            tt.push(::syntax::ast::TtToken(_sp,
                                                                           ::syntax::parse::token::CloseDelim(::syntax::parse::token::Brace)));
                                            tt
                                        }).parse_arm()
                }
            }
            ast::TupleVariantKind(ref args) => {
                let expr =
                    deserialize_tuple_variant(cx, builder, type_ident,
                                              variant_ident, generics, ty,
                                              args.len());
                {
                    #[allow(unused_imports)]
                    use quasi::*;
                    let ext_cx = &*cx;
                    new_parser_from_tts(ext_cx.parse_sess(), ext_cx.cfg(),
                                        {
                                            let _sp = ext_cx.call_site();
                                            let mut tt =
                                                ::std::vec::Vec::new();
                                            tt.extend(variant_name.to_tokens(ext_cx).into_iter());
                                            tt.push(::syntax::ast::TtToken(_sp,
                                                                           ::syntax::parse::token::FatArrow));
                                            tt.push(::syntax::ast::TtToken(_sp,
                                                                           ::syntax::parse::token::OpenDelim(::syntax::parse::token::Brace)));
                                            tt.extend(expr.to_tokens(ext_cx).into_iter());
                                            tt.push(::syntax::ast::TtToken(_sp,
                                                                           ::syntax::parse::token::CloseDelim(::syntax::parse::token::Brace)));
                                            tt
                                        }).parse_arm()
                }
            }
            ast::StructVariantKind(ref struct_def) => {
                let expr =
                    deserialize_struct_variant(cx, builder, type_ident,
                                               variant_ident, generics, ty,
                                               struct_def);
                {
                    #[allow(unused_imports)]
                    use quasi::*;
                    let ext_cx = &*cx;
                    new_parser_from_tts(ext_cx.parse_sess(), ext_cx.cfg(),
                                        {
                                            let _sp = ext_cx.call_site();
                                            let mut tt =
                                                ::std::vec::Vec::new();
                                            tt.extend(variant_name.to_tokens(ext_cx).into_iter());
                                            tt.push(::syntax::ast::TtToken(_sp,
                                                                           ::syntax::parse::token::FatArrow));
                                            tt.push(::syntax::ast::TtToken(_sp,
                                                                           ::syntax::parse::token::OpenDelim(::syntax::parse::token::Brace)));
                                            tt.extend(expr.to_tokens(ext_cx).into_iter());
                                            tt.push(::syntax::ast::TtToken(_sp,
                                                                           ::syntax::parse::token::CloseDelim(::syntax::parse::token::Brace)));
                                            tt
                                        }).parse_arm()
                }
            }
        }
    }
    fn deserialize_tuple_variant(cx: &ExtCtxt, builder: &aster::AstBuilder,
                                 type_ident: ast::Ident,
                                 variant_ident: ast::Ident,
                                 generics: &ast::Generics, ty: P<ast::Ty>,
                                 fields: usize) -> P<ast::Expr> {
        let where_clause = &generics.where_clause;
        let (visitor_item, visitor_ty, visitor_expr) =
            deserialize_visitor(builder, generics);
        let visit_seq_expr =
            deserialize_seq(cx, builder,
                            builder.path().id(type_ident).id(variant_ident).build(),
                            fields);
        {
            #[allow(unused_imports)]
            use quasi::*;
            let ext_cx = &*cx;
            new_parser_from_tts(ext_cx.parse_sess(), ext_cx.cfg(),
                                {
                                    let _sp = ext_cx.call_site();
                                    let mut tt = ::std::vec::Vec::new();
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::OpenDelim(::syntax::parse::token::Brace)));
                                    tt.extend(visitor_item.to_tokens(ext_cx).into_iter());
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("impl"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.extend(generics.to_tokens(ext_cx).into_iter());
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::ModSep));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("serde"),
                                                                                                 ::syntax::parse::token::ModName)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::ModSep));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("de"),
                                                                                                 ::syntax::parse::token::ModName)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::ModSep));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("EnumSeqVisitor"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("for"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.extend(visitor_ty.to_tokens(ext_cx).into_iter());
                                    tt.extend(where_clause.to_tokens(ext_cx).into_iter());
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::OpenDelim(::syntax::parse::token::Brace)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("type"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("Value"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Eq));
                                    tt.extend(ty.to_tokens(ext_cx).into_iter());
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Semi));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("fn"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("visit"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Lt));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("V"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Colon));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::ModSep));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("serde"),
                                                                                                 ::syntax::parse::token::ModName)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::ModSep));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("de"),
                                                                                                 ::syntax::parse::token::ModName)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::ModSep));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("SeqVisitor"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Comma));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Gt));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::OpenDelim(::syntax::parse::token::Paren)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::BinOp(::syntax::parse::token::And)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("mut"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("self"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Comma));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("mut"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("visitor"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Colon));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("V"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::CloseDelim(::syntax::parse::token::Paren)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::RArrow));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("Result"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Lt));
                                    tt.extend(ty.to_tokens(ext_cx).into_iter());
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Comma));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("V"),
                                                                                                 ::syntax::parse::token::ModName)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::ModSep));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("Error"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Gt));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::OpenDelim(::syntax::parse::token::Brace)));
                                    tt.extend(visit_seq_expr.to_tokens(ext_cx).into_iter());
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::CloseDelim(::syntax::parse::token::Brace)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::CloseDelim(::syntax::parse::token::Brace)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("visitor"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Dot));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("visit_seq"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::OpenDelim(::syntax::parse::token::Paren)));
                                    tt.extend(visitor_expr.to_tokens(ext_cx).into_iter());
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::CloseDelim(::syntax::parse::token::Paren)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::CloseDelim(::syntax::parse::token::Brace)));
                                    tt
                                }).parse_expr()
        }
    }
    fn deserialize_struct_variant(cx: &ExtCtxt, builder: &aster::AstBuilder,
                                  type_ident: ast::Ident,
                                  variant_ident: ast::Ident,
                                  generics: &ast::Generics, ty: P<ast::Ty>,
                                  struct_def: &ast::StructDef)
     -> P<ast::Expr> {
        let where_clause = &generics.where_clause;
        let (field_visitor, field_expr) =
            deserialize_struct_visitor(cx, builder, struct_def,
                                       builder.path().id(type_ident).id(variant_ident).build());
        let (visitor_item, visitor_ty, visitor_expr) =
            deserialize_visitor(builder, generics);
        {
            #[allow(unused_imports)]
            use quasi::*;
            let ext_cx = &*cx;
            new_parser_from_tts(ext_cx.parse_sess(), ext_cx.cfg(),
                                {
                                    let _sp = ext_cx.call_site();
                                    let mut tt = ::std::vec::Vec::new();
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::OpenDelim(::syntax::parse::token::Brace)));
                                    tt.extend(field_visitor.to_tokens(ext_cx).into_iter());
                                    tt.extend(visitor_item.to_tokens(ext_cx).into_iter());
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("impl"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.extend(generics.to_tokens(ext_cx).into_iter());
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::ModSep));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("serde"),
                                                                                                 ::syntax::parse::token::ModName)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::ModSep));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("de"),
                                                                                                 ::syntax::parse::token::ModName)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::ModSep));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("EnumMapVisitor"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("for"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.extend(visitor_ty.to_tokens(ext_cx).into_iter());
                                    tt.extend(where_clause.to_tokens(ext_cx).into_iter());
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::OpenDelim(::syntax::parse::token::Brace)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("type"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("Value"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Eq));
                                    tt.extend(ty.to_tokens(ext_cx).into_iter());
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Semi));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("fn"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("visit"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Lt));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("V"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Colon));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::ModSep));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("serde"),
                                                                                                 ::syntax::parse::token::ModName)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::ModSep));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("de"),
                                                                                                 ::syntax::parse::token::ModName)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::ModSep));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("MapVisitor"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Comma));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Gt));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::OpenDelim(::syntax::parse::token::Paren)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::BinOp(::syntax::parse::token::And)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("mut"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("self"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Comma));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("mut"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("visitor"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Colon));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("V"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::CloseDelim(::syntax::parse::token::Paren)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::RArrow));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("Result"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Lt));
                                    tt.extend(ty.to_tokens(ext_cx).into_iter());
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Comma));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("V"),
                                                                                                 ::syntax::parse::token::ModName)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::ModSep));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("Error"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Gt));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::OpenDelim(::syntax::parse::token::Brace)));
                                    tt.extend(field_expr.to_tokens(ext_cx).into_iter());
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::CloseDelim(::syntax::parse::token::Brace)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::CloseDelim(::syntax::parse::token::Brace)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("visitor"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Dot));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("visit_map"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::OpenDelim(::syntax::parse::token::Paren)));
                                    tt.extend(visitor_expr.to_tokens(ext_cx).into_iter());
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::CloseDelim(::syntax::parse::token::Paren)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::CloseDelim(::syntax::parse::token::Brace)));
                                    tt
                                }).parse_expr()
        }
    }
    fn deserialize_field_visitor(cx: &ExtCtxt, builder: &aster::AstBuilder,
                                 struct_def: &StructDef)
     -> Vec<P<ast::Item>> {
        let field_names: Vec<ast::Ident> =
            (0..struct_def.fields.len()).map(|i|
                                                 builder.id(::std::fmt::format(::std::fmt::Arguments::new_v1({
                                                                                                                 static __STATIC_FMTSTR:
                                                                                                                        &'static [&'static str]
                                                                                                                        =
                                                                                                                     &["__field"];
                                                                                                                 __STATIC_FMTSTR
                                                                                                             },
                                                                                                             &match (&i,)
                                                                                                                  {
                                                                                                                  (__arg0,)
                                                                                                                  =>
                                                                                                                  [::std::fmt::ArgumentV1::new(__arg0,
                                                                                                                                               ::std::fmt::Display::fmt)],
                                                                                                              })))).collect();
        let field_enum =
            builder.item().attr().allow(&["non_camel_case_types"]).enum_("__Field").with_variants(field_names.iter().map(|field|
                                                                                                                             {
                                                                                                                         builder.variant(field).tuple().build()
                                                                                                                     })).build();
        let aliases = field::struct_field_strs(cx, builder, struct_def);
        let field_arms: Vec<ast::Arm> =
            aliases.iter().zip(field_names.iter()).map(|(alias, field_name)| {
                                                       {
                                                           #[allow(unused_imports)]
                                                           use quasi::*;
                                                           let ext_cx = &*cx;
                                                           new_parser_from_tts(ext_cx.parse_sess(),
                                                                               ext_cx.cfg(),
                                                                               {
                                                                                   let _sp =
                                                                                       ext_cx.call_site();
                                                                                   let mut tt =
                                                                                       ::std::vec::Vec::new();
                                                                                   tt.extend(alias.to_tokens(ext_cx).into_iter());
                                                                                   tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                  ::syntax::parse::token::FatArrow));
                                                                                   tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                  ::syntax::parse::token::OpenDelim(::syntax::parse::token::Brace)));
                                                                                   tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                  ::syntax::parse::token::Ident(ext_cx.ident_of("Ok"),
                                                                                                                                                ::syntax::parse::token::Plain)));
                                                                                   tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                  ::syntax::parse::token::OpenDelim(::syntax::parse::token::Paren)));
                                                                                   tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                  ::syntax::parse::token::Ident(ext_cx.ident_of("__Field"),
                                                                                                                                                ::syntax::parse::token::ModName)));
                                                                                   tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                  ::syntax::parse::token::ModSep));
                                                                                   tt.extend(field_name.to_tokens(ext_cx).into_iter());
                                                                                   tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                  ::syntax::parse::token::CloseDelim(::syntax::parse::token::Paren)));
                                                                                   tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                  ::syntax::parse::token::CloseDelim(::syntax::parse::token::Brace)));
                                                                                   tt
                                                                               }).parse_arm()
                                                       } }).collect();
        <[_] as
            ::std::slice::SliceExt>::into_vec(::std::boxed::Box::new([field_enum,
                                                                      {
                                                                          #[allow(unused_imports)]
                                                                          use quasi::*;
                                                                          let ext_cx =
                                                                              &*cx;
                                                                          new_parser_from_tts(ext_cx.parse_sess(),
                                                                                              ext_cx.cfg(),
                                                                                              {
                                                                                                  let _sp =
                                                                                                      ext_cx.call_site();
                                                                                                  let mut tt =
                                                                                                      ::std::vec::Vec::new();
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::Ident(ext_cx.ident_of("impl"),
                                                                                                                                                               ::syntax::parse::token::Plain)));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::ModSep));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::Ident(ext_cx.ident_of("serde"),
                                                                                                                                                               ::syntax::parse::token::ModName)));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::ModSep));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::Ident(ext_cx.ident_of("de"),
                                                                                                                                                               ::syntax::parse::token::ModName)));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::ModSep));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::Ident(ext_cx.ident_of("Deserialize"),
                                                                                                                                                               ::syntax::parse::token::Plain)));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::Ident(ext_cx.ident_of("for"),
                                                                                                                                                               ::syntax::parse::token::Plain)));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::Ident(ext_cx.ident_of("__Field"),
                                                                                                                                                               ::syntax::parse::token::Plain)));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::OpenDelim(::syntax::parse::token::Brace)));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::Pound));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::OpenDelim(::syntax::parse::token::Bracket)));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::Ident(ext_cx.ident_of("inline"),
                                                                                                                                                               ::syntax::parse::token::Plain)));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::CloseDelim(::syntax::parse::token::Bracket)));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::Ident(ext_cx.ident_of("fn"),
                                                                                                                                                               ::syntax::parse::token::Plain)));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::Ident(ext_cx.ident_of("deserialize"),
                                                                                                                                                               ::syntax::parse::token::Plain)));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::Lt));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::Ident(ext_cx.ident_of("D"),
                                                                                                                                                               ::syntax::parse::token::Plain)));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::Gt));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::OpenDelim(::syntax::parse::token::Paren)));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::Ident(ext_cx.ident_of("deserializer"),
                                                                                                                                                               ::syntax::parse::token::Plain)));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::Colon));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::BinOp(::syntax::parse::token::And)));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::Ident(ext_cx.ident_of("mut"),
                                                                                                                                                               ::syntax::parse::token::Plain)));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::Ident(ext_cx.ident_of("D"),
                                                                                                                                                               ::syntax::parse::token::Plain)));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::CloseDelim(::syntax::parse::token::Paren)));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::RArrow));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::Ident(ext_cx.ident_of("Result"),
                                                                                                                                                               ::syntax::parse::token::Plain)));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::Lt));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::Ident(ext_cx.ident_of("__Field"),
                                                                                                                                                               ::syntax::parse::token::Plain)));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::Comma));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::Ident(ext_cx.ident_of("D"),
                                                                                                                                                               ::syntax::parse::token::ModName)));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::ModSep));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::Ident(ext_cx.ident_of("Error"),
                                                                                                                                                               ::syntax::parse::token::Plain)));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::Gt));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::Ident(ext_cx.ident_of("where"),
                                                                                                                                                               ::syntax::parse::token::Plain)));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::Ident(ext_cx.ident_of("D"),
                                                                                                                                                               ::syntax::parse::token::Plain)));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::Colon));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::ModSep));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::Ident(ext_cx.ident_of("serde"),
                                                                                                                                                               ::syntax::parse::token::ModName)));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::ModSep));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::Ident(ext_cx.ident_of("de"),
                                                                                                                                                               ::syntax::parse::token::ModName)));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::ModSep));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::Ident(ext_cx.ident_of("Deserializer"),
                                                                                                                                                               ::syntax::parse::token::Plain)));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::Comma));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::OpenDelim(::syntax::parse::token::Brace)));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::Ident(ext_cx.ident_of("struct"),
                                                                                                                                                               ::syntax::parse::token::Plain)));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::Ident(ext_cx.ident_of("__FieldVisitor"),
                                                                                                                                                               ::syntax::parse::token::Plain)));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::Semi));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::Ident(ext_cx.ident_of("impl"),
                                                                                                                                                               ::syntax::parse::token::Plain)));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::ModSep));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::Ident(ext_cx.ident_of("serde"),
                                                                                                                                                               ::syntax::parse::token::ModName)));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::ModSep));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::Ident(ext_cx.ident_of("de"),
                                                                                                                                                               ::syntax::parse::token::ModName)));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::ModSep));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::Ident(ext_cx.ident_of("Visitor"),
                                                                                                                                                               ::syntax::parse::token::Plain)));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::Ident(ext_cx.ident_of("for"),
                                                                                                                                                               ::syntax::parse::token::Plain)));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::Ident(ext_cx.ident_of("__FieldVisitor"),
                                                                                                                                                               ::syntax::parse::token::Plain)));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::OpenDelim(::syntax::parse::token::Brace)));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::Ident(ext_cx.ident_of("type"),
                                                                                                                                                               ::syntax::parse::token::Plain)));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::Ident(ext_cx.ident_of("Value"),
                                                                                                                                                               ::syntax::parse::token::Plain)));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::Eq));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::Ident(ext_cx.ident_of("__Field"),
                                                                                                                                                               ::syntax::parse::token::Plain)));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::Semi));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::Ident(ext_cx.ident_of("fn"),
                                                                                                                                                               ::syntax::parse::token::Plain)));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::Ident(ext_cx.ident_of("visit_str"),
                                                                                                                                                               ::syntax::parse::token::Plain)));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::Lt));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::Ident(ext_cx.ident_of("E"),
                                                                                                                                                               ::syntax::parse::token::Plain)));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::Gt));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::OpenDelim(::syntax::parse::token::Paren)));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::BinOp(::syntax::parse::token::And)));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::Ident(ext_cx.ident_of("mut"),
                                                                                                                                                               ::syntax::parse::token::Plain)));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::Ident(ext_cx.ident_of("self"),
                                                                                                                                                               ::syntax::parse::token::Plain)));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::Comma));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::Ident(ext_cx.ident_of("value"),
                                                                                                                                                               ::syntax::parse::token::Plain)));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::Colon));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::BinOp(::syntax::parse::token::And)));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::Ident(ext_cx.ident_of("str"),
                                                                                                                                                               ::syntax::parse::token::Plain)));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::CloseDelim(::syntax::parse::token::Paren)));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::RArrow));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::Ident(ext_cx.ident_of("Result"),
                                                                                                                                                               ::syntax::parse::token::Plain)));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::Lt));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::Ident(ext_cx.ident_of("__Field"),
                                                                                                                                                               ::syntax::parse::token::Plain)));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::Comma));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::Ident(ext_cx.ident_of("E"),
                                                                                                                                                               ::syntax::parse::token::Plain)));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::Gt));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::Ident(ext_cx.ident_of("where"),
                                                                                                                                                               ::syntax::parse::token::Plain)));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::Ident(ext_cx.ident_of("E"),
                                                                                                                                                               ::syntax::parse::token::Plain)));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::Colon));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::ModSep));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::Ident(ext_cx.ident_of("serde"),
                                                                                                                                                               ::syntax::parse::token::ModName)));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::ModSep));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::Ident(ext_cx.ident_of("de"),
                                                                                                                                                               ::syntax::parse::token::ModName)));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::ModSep));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::Ident(ext_cx.ident_of("Error"),
                                                                                                                                                               ::syntax::parse::token::Plain)));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::Comma));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::OpenDelim(::syntax::parse::token::Brace)));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::Ident(ext_cx.ident_of("match"),
                                                                                                                                                               ::syntax::parse::token::Plain)));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::Ident(ext_cx.ident_of("value"),
                                                                                                                                                               ::syntax::parse::token::Plain)));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::OpenDelim(::syntax::parse::token::Brace)));
                                                                                                  tt.extend(field_arms.to_tokens(ext_cx).into_iter());
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::Underscore));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::FatArrow));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::Ident(ext_cx.ident_of("Err"),
                                                                                                                                                               ::syntax::parse::token::Plain)));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::OpenDelim(::syntax::parse::token::Paren)));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::ModSep));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::Ident(ext_cx.ident_of("serde"),
                                                                                                                                                               ::syntax::parse::token::ModName)));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::ModSep));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::Ident(ext_cx.ident_of("de"),
                                                                                                                                                               ::syntax::parse::token::ModName)));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::ModSep));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::Ident(ext_cx.ident_of("Error"),
                                                                                                                                                               ::syntax::parse::token::ModName)));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::ModSep));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::Ident(ext_cx.ident_of("syntax_error"),
                                                                                                                                                               ::syntax::parse::token::Plain)));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::OpenDelim(::syntax::parse::token::Paren)));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::CloseDelim(::syntax::parse::token::Paren)));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::CloseDelim(::syntax::parse::token::Paren)));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::Comma));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::CloseDelim(::syntax::parse::token::Brace)));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::CloseDelim(::syntax::parse::token::Brace)));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::CloseDelim(::syntax::parse::token::Brace)));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::Ident(ext_cx.ident_of("deserializer"),
                                                                                                                                                               ::syntax::parse::token::Plain)));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::Dot));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::Ident(ext_cx.ident_of("visit"),
                                                                                                                                                               ::syntax::parse::token::Plain)));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::OpenDelim(::syntax::parse::token::Paren)));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::Ident(ext_cx.ident_of("__FieldVisitor"),
                                                                                                                                                               ::syntax::parse::token::Plain)));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::CloseDelim(::syntax::parse::token::Paren)));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::CloseDelim(::syntax::parse::token::Brace)));
                                                                                                  tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                 ::syntax::parse::token::CloseDelim(::syntax::parse::token::Brace)));
                                                                                                  tt
                                                                                              }).parse_item_with_outer_attributes()
                                                                      }.unwrap()]))
    }
    fn deserialize_struct_visitor(cx: &ExtCtxt, builder: &aster::AstBuilder,
                                  struct_def: &ast::StructDef,
                                  struct_path: ast::Path)
     -> (Vec<P<ast::Item>>, P<ast::Expr>) {
        let field_visitor =
            deserialize_field_visitor(cx, builder, struct_def);
        let visit_map_expr =
            deserialize_map(cx, builder, struct_path, struct_def);
        (field_visitor, visit_map_expr)
    }
    fn deserialize_map(cx: &ExtCtxt, builder: &aster::AstBuilder,
                       struct_path: ast::Path, struct_def: &StructDef)
     -> P<ast::Expr> {
        let field_names: Vec<ast::Ident> =
            (0..struct_def.fields.len()).map(|i|
                                                 builder.id(::std::fmt::format(::std::fmt::Arguments::new_v1({
                                                                                                                 static __STATIC_FMTSTR:
                                                                                                                        &'static [&'static str]
                                                                                                                        =
                                                                                                                     &["__field"];
                                                                                                                 __STATIC_FMTSTR
                                                                                                             },
                                                                                                             &match (&i,)
                                                                                                                  {
                                                                                                                  (__arg0,)
                                                                                                                  =>
                                                                                                                  [::std::fmt::ArgumentV1::new(__arg0,
                                                                                                                                               ::std::fmt::Display::fmt)],
                                                                                                              })))).collect();
        let let_values: Vec<P<ast::Stmt>> =
            field_names.iter().map(|field_name| {
                                   #[allow(unused_imports)]
                                   use quasi::*; let ext_cx = &*cx;
                                   new_parser_from_tts(ext_cx.parse_sess(),
                                                       ext_cx.cfg(),
                                                       {
                                                           let _sp =
                                                               ext_cx.call_site();
                                                           let mut tt =
                                                               ::std::vec::Vec::new();
                                                           tt.push(::syntax::ast::TtToken(_sp,
                                                                                          ::syntax::parse::token::Ident(ext_cx.ident_of("let"),
                                                                                                                        ::syntax::parse::token::Plain)));
                                                           tt.push(::syntax::ast::TtToken(_sp,
                                                                                          ::syntax::parse::token::Ident(ext_cx.ident_of("mut"),
                                                                                                                        ::syntax::parse::token::Plain)));
                                                           tt.extend(field_name.to_tokens(ext_cx).into_iter());
                                                           tt.push(::syntax::ast::TtToken(_sp,
                                                                                          ::syntax::parse::token::Eq));
                                                           tt.push(::syntax::ast::TtToken(_sp,
                                                                                          ::syntax::parse::token::Ident(ext_cx.ident_of("None"),
                                                                                                                        ::syntax::parse::token::Plain)));
                                                           tt.push(::syntax::ast::TtToken(_sp,
                                                                                          ::syntax::parse::token::Semi));
                                                           tt
                                                       }).parse_stmt(::std::vec::Vec::new())
                               }).collect();
        let value_arms: Vec<ast::Arm> =
            field_names.iter().map(|field_name| {
                                   {
                                       #[allow(unused_imports)]
                                       use quasi::*;
                                       let ext_cx = &*cx;
                                       new_parser_from_tts(ext_cx.parse_sess(),
                                                           ext_cx.cfg(),
                                                           {
                                                               let _sp =
                                                                   ext_cx.call_site();
                                                               let mut tt =
                                                                   ::std::vec::Vec::new();
                                                               tt.push(::syntax::ast::TtToken(_sp,
                                                                                              ::syntax::parse::token::Ident(ext_cx.ident_of("__Field"),
                                                                                                                            ::syntax::parse::token::ModName)));
                                                               tt.push(::syntax::ast::TtToken(_sp,
                                                                                              ::syntax::parse::token::ModSep));
                                                               tt.extend(field_name.to_tokens(ext_cx).into_iter());
                                                               tt.push(::syntax::ast::TtToken(_sp,
                                                                                              ::syntax::parse::token::FatArrow));
                                                               tt.push(::syntax::ast::TtToken(_sp,
                                                                                              ::syntax::parse::token::OpenDelim(::syntax::parse::token::Brace)));
                                                               tt.extend(field_name.to_tokens(ext_cx).into_iter());
                                                               tt.push(::syntax::ast::TtToken(_sp,
                                                                                              ::syntax::parse::token::Eq));
                                                               tt.push(::syntax::ast::TtToken(_sp,
                                                                                              ::syntax::parse::token::Ident(ext_cx.ident_of("Some"),
                                                                                                                            ::syntax::parse::token::Plain)));
                                                               tt.push(::syntax::ast::TtToken(_sp,
                                                                                              ::syntax::parse::token::OpenDelim(::syntax::parse::token::Paren)));
                                                               tt.push(::syntax::ast::TtToken(_sp,
                                                                                              ::syntax::parse::token::Ident(ext_cx.ident_of("try"),
                                                                                                                            ::syntax::parse::token::Plain)));
                                                               tt.push(::syntax::ast::TtToken(_sp,
                                                                                              ::syntax::parse::token::Not));
                                                               tt.push(::syntax::ast::TtToken(_sp,
                                                                                              ::syntax::parse::token::OpenDelim(::syntax::parse::token::Paren)));
                                                               tt.push(::syntax::ast::TtToken(_sp,
                                                                                              ::syntax::parse::token::Ident(ext_cx.ident_of("visitor"),
                                                                                                                            ::syntax::parse::token::Plain)));
                                                               tt.push(::syntax::ast::TtToken(_sp,
                                                                                              ::syntax::parse::token::Dot));
                                                               tt.push(::syntax::ast::TtToken(_sp,
                                                                                              ::syntax::parse::token::Ident(ext_cx.ident_of("visit_value"),
                                                                                                                            ::syntax::parse::token::Plain)));
                                                               tt.push(::syntax::ast::TtToken(_sp,
                                                                                              ::syntax::parse::token::OpenDelim(::syntax::parse::token::Paren)));
                                                               tt.push(::syntax::ast::TtToken(_sp,
                                                                                              ::syntax::parse::token::CloseDelim(::syntax::parse::token::Paren)));
                                                               tt.push(::syntax::ast::TtToken(_sp,
                                                                                              ::syntax::parse::token::CloseDelim(::syntax::parse::token::Paren)));
                                                               tt.push(::syntax::ast::TtToken(_sp,
                                                                                              ::syntax::parse::token::CloseDelim(::syntax::parse::token::Paren)));
                                                               tt.push(::syntax::ast::TtToken(_sp,
                                                                                              ::syntax::parse::token::Semi));
                                                               tt.push(::syntax::ast::TtToken(_sp,
                                                                                              ::syntax::parse::token::CloseDelim(::syntax::parse::token::Brace)));
                                                               tt
                                                           }).parse_arm()
                                   } }).collect();
        let extract_values: Vec<P<ast::Stmt>> =
            field_names.iter().zip(struct_def.fields.iter()).map(|(field_name,
                                                                   field)| {
                                                                 let name_str =
                                                                     match field.node.kind
                                                                         {
                                                                         ast::NamedField(name,
                                                                                         _)
                                                                         =>
                                                                         builder.expr().str(name),
                                                                         ast::UnnamedField(_)
                                                                         => {
                                                                             ::std::rt::begin_unwind("struct contains unnamed fields",
                                                                                                     {
                                                                                                         static _FILE_LINE:
                                                                                                                (&'static str,
                                                                                                                 usize)
                                                                                                                =
                                                                                                             ("src/de.rs",
                                                                                                              690u32
                                                                                                                  as
                                                                                                                  usize);
                                                                                                         &_FILE_LINE
                                                                                                     })
                                                                         }
                                                                     };
                                                                 let missing_expr =
                                                                     if field::default_value(field)
                                                                        {
                                                                         {
                                                                             #[allow(unused_imports)]
                                                                             use quasi::*;
                                                                             let ext_cx =
                                                                                 &*cx;
                                                                             new_parser_from_tts(ext_cx.parse_sess(),
                                                                                                 ext_cx.cfg(),
                                                                                                 {
                                                                                                     let _sp =
                                                                                                         ext_cx.call_site();
                                                                                                     let mut tt =
                                                                                                         ::std::vec::Vec::new();
                                                                                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                    ::syntax::parse::token::ModSep));
                                                                                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                    ::syntax::parse::token::Ident(ext_cx.ident_of("std"),
                                                                                                                                                                  ::syntax::parse::token::ModName)));
                                                                                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                    ::syntax::parse::token::ModSep));
                                                                                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                    ::syntax::parse::token::Ident(ext_cx.ident_of("default"),
                                                                                                                                                                  ::syntax::parse::token::ModName)));
                                                                                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                    ::syntax::parse::token::ModSep));
                                                                                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                    ::syntax::parse::token::Ident(ext_cx.ident_of("Default"),
                                                                                                                                                                  ::syntax::parse::token::ModName)));
                                                                                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                    ::syntax::parse::token::ModSep));
                                                                                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                    ::syntax::parse::token::Ident(ext_cx.ident_of("default"),
                                                                                                                                                                  ::syntax::parse::token::Plain)));
                                                                                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                    ::syntax::parse::token::OpenDelim(::syntax::parse::token::Paren)));
                                                                                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                    ::syntax::parse::token::CloseDelim(::syntax::parse::token::Paren)));
                                                                                                     tt
                                                                                                 }).parse_expr()
                                                                         }
                                                                     } else {
                                                                         {
                                                                             #[allow(unused_imports)]
                                                                             use quasi::*;
                                                                             let ext_cx =
                                                                                 &*cx;
                                                                             new_parser_from_tts(ext_cx.parse_sess(),
                                                                                                 ext_cx.cfg(),
                                                                                                 {
                                                                                                     let _sp =
                                                                                                         ext_cx.call_site();
                                                                                                     let mut tt =
                                                                                                         ::std::vec::Vec::new();
                                                                                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                    ::syntax::parse::token::Ident(ext_cx.ident_of("try"),
                                                                                                                                                                  ::syntax::parse::token::Plain)));
                                                                                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                    ::syntax::parse::token::Not));
                                                                                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                    ::syntax::parse::token::OpenDelim(::syntax::parse::token::Paren)));
                                                                                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                    ::syntax::parse::token::Ident(ext_cx.ident_of("visitor"),
                                                                                                                                                                  ::syntax::parse::token::Plain)));
                                                                                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                    ::syntax::parse::token::Dot));
                                                                                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                    ::syntax::parse::token::Ident(ext_cx.ident_of("missing_field"),
                                                                                                                                                                  ::syntax::parse::token::Plain)));
                                                                                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                    ::syntax::parse::token::OpenDelim(::syntax::parse::token::Paren)));
                                                                                                     tt.extend(name_str.to_tokens(ext_cx).into_iter());
                                                                                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                    ::syntax::parse::token::CloseDelim(::syntax::parse::token::Paren)));
                                                                                                     tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                                    ::syntax::parse::token::CloseDelim(::syntax::parse::token::Paren)));
                                                                                                     tt
                                                                                                 }).parse_expr()
                                                                         }
                                                                     };
                                                                 {
                                                                     #[allow(unused_imports)]
                                                                     use quasi::*;
                                                                     let ext_cx =
                                                                         &*cx;
                                                                     new_parser_from_tts(ext_cx.parse_sess(),
                                                                                         ext_cx.cfg(),
                                                                                         {
                                                                                             let _sp =
                                                                                                 ext_cx.call_site();
                                                                                             let mut tt =
                                                                                                 ::std::vec::Vec::new();
                                                                                             tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                            ::syntax::parse::token::Ident(ext_cx.ident_of("let"),
                                                                                                                                                          ::syntax::parse::token::Plain)));
                                                                                             tt.extend(field_name.to_tokens(ext_cx).into_iter());
                                                                                             tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                            ::syntax::parse::token::Eq));
                                                                                             tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                            ::syntax::parse::token::Ident(ext_cx.ident_of("match"),
                                                                                                                                                          ::syntax::parse::token::Plain)));
                                                                                             tt.extend(field_name.to_tokens(ext_cx).into_iter());
                                                                                             tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                            ::syntax::parse::token::OpenDelim(::syntax::parse::token::Brace)));
                                                                                             tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                            ::syntax::parse::token::Ident(ext_cx.ident_of("Some"),
                                                                                                                                                          ::syntax::parse::token::Plain)));
                                                                                             tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                            ::syntax::parse::token::OpenDelim(::syntax::parse::token::Paren)));
                                                                                             tt.extend(field_name.to_tokens(ext_cx).into_iter());
                                                                                             tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                            ::syntax::parse::token::CloseDelim(::syntax::parse::token::Paren)));
                                                                                             tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                            ::syntax::parse::token::FatArrow));
                                                                                             tt.extend(field_name.to_tokens(ext_cx).into_iter());
                                                                                             tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                            ::syntax::parse::token::Comma));
                                                                                             tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                            ::syntax::parse::token::Ident(ext_cx.ident_of("None"),
                                                                                                                                                          ::syntax::parse::token::Plain)));
                                                                                             tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                            ::syntax::parse::token::FatArrow));
                                                                                             tt.extend(missing_expr.to_tokens(ext_cx).into_iter());
                                                                                             tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                            ::syntax::parse::token::Comma));
                                                                                             tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                            ::syntax::parse::token::CloseDelim(::syntax::parse::token::Brace)));
                                                                                             tt.push(::syntax::ast::TtToken(_sp,
                                                                                                                            ::syntax::parse::token::Semi));
                                                                                             tt
                                                                                         }).parse_stmt(::std::vec::Vec::new())
                                                                 }
                                                             }).collect();
        let result =
            builder.expr().struct_path(struct_path).with_id_exprs(struct_def.fields.iter().zip(field_names.iter()).map(|(field,
                                                                                                                         field_name)|
                                                                                                                           {
                                                                                                                       (match field.node.kind
                                                                                                                            {
                                                                                                                            ast::NamedField(name,
                                                                                                                                            _)
                                                                                                                            =>
                                                                                                                            name.clone(),
                                                                                                                            ast::UnnamedField(_)
                                                                                                                            =>
                                                                                                                            {
                                                                                                                                ::std::rt::begin_unwind("struct contains unnamed fields",
                                                                                                                                                        {
                                                                                                                                                            static _FILE_LINE:
                                                                                                                                                                   (&'static str,
                                                                                                                                                                    usize)
                                                                                                                                                                   =
                                                                                                                                                                ("src/de.rs",
                                                                                                                                                                 716u32
                                                                                                                                                                     as
                                                                                                                                                                     usize);
                                                                                                                                                            &_FILE_LINE
                                                                                                                                                        })
                                                                                                                            }
                                                                                                                        },
                                                                                                                        builder.expr().id(field_name))
                                                                                                                   })).build();
        {
            #[allow(unused_imports)]
            use quasi::*;
            let ext_cx = &*cx;
            new_parser_from_tts(ext_cx.parse_sess(), ext_cx.cfg(),
                                {
                                    let _sp = ext_cx.call_site();
                                    let mut tt = ::std::vec::Vec::new();
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::OpenDelim(::syntax::parse::token::Brace)));
                                    tt.extend(let_values.to_tokens(ext_cx).into_iter());
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("while"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("let"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("Some"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::OpenDelim(::syntax::parse::token::Paren)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("key"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::CloseDelim(::syntax::parse::token::Paren)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Eq));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("try"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Not));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::OpenDelim(::syntax::parse::token::Paren)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("visitor"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Dot));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("visit_key"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::OpenDelim(::syntax::parse::token::Paren)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::CloseDelim(::syntax::parse::token::Paren)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::CloseDelim(::syntax::parse::token::Paren)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::OpenDelim(::syntax::parse::token::Brace)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("match"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("key"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::OpenDelim(::syntax::parse::token::Brace)));
                                    tt.extend(value_arms.to_tokens(ext_cx).into_iter());
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::CloseDelim(::syntax::parse::token::Brace)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::CloseDelim(::syntax::parse::token::Brace)));
                                    tt.extend(extract_values.to_tokens(ext_cx).into_iter());
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("try"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Not));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::OpenDelim(::syntax::parse::token::Paren)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("visitor"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Dot));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("end"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::OpenDelim(::syntax::parse::token::Paren)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::CloseDelim(::syntax::parse::token::Paren)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::CloseDelim(::syntax::parse::token::Paren)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Semi));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::Ident(ext_cx.ident_of("Ok"),
                                                                                                 ::syntax::parse::token::Plain)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::OpenDelim(::syntax::parse::token::Paren)));
                                    tt.extend(result.to_tokens(ext_cx).into_iter());
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::CloseDelim(::syntax::parse::token::Paren)));
                                    tt.push(::syntax::ast::TtToken(_sp,
                                                                   ::syntax::parse::token::CloseDelim(::syntax::parse::token::Brace)));
                                    tt
                                }).parse_expr()
        }
    }
}
mod field {
    #[prelude_import]
    use std::prelude::v1::*;
    use syntax::ast;
    use syntax::ext::base::ExtCtxt;
    use syntax::ptr::P;
    use aster;
    fn field_alias(field: &ast::StructField) -> Option<&ast::Lit> {
        field.node.attrs.iter().find(|sa| {
                                     match sa.node.value.node {
                                         ast::MetaList(ref n, _) => {
                                             n == &"serde"
                                         }
                                         _ => { false }
                                     }
                                 }).and_then(|sa| {
                                             match sa.node.value.node {
                                                 ast::MetaList(_, ref vals) =>
                                                 {
                                                     vals.iter().fold(None,
                                                                      |v, mi|
                                                                          {
                                                                      match mi.node
                                                                          {
                                                                          ast::MetaNameValue(ref n,
                                                                                             ref lit)
                                                                          => {
                                                                              if n
                                                                                     ==
                                                                                     &"alias"
                                                                                 {
                                                                                  Some(lit)
                                                                              } else {
                                                                                  v
                                                                              }
                                                                          }
                                                                          _ =>
                                                                          {
                                                                              v
                                                                          }
                                                                      } })
                                                 }
                                                 _ => { None }
                                             } })
    }
    pub fn struct_field_strs(cx: &ExtCtxt, builder: &aster::AstBuilder,
                             struct_def: &ast::StructDef)
     -> Vec<P<ast::Expr>> {
        struct_def.fields.iter().map(|field| {
                                     match field_alias(field) {
                                         Some(alias) =>
                                         builder.expr().build_lit(P(alias.clone())),
                                         None => {
                                             match field.node.kind {
                                                 ast::NamedField(name, _) => {
                                                     builder.expr().str(name)
                                                 }
                                                 ast::UnnamedField(_) => {
                                                     cx.bug("struct has named and unnamed fields")
                                                 }
                                             }
                                         }
                                     } }).collect()
    }
    pub fn default_value(field: &ast::StructField) -> bool {
        field.node.attrs.iter().any(|sa| {
                                    match sa.node.value.node {
                                        ast::MetaItem_::MetaList(ref n,
                                                                 ref vals) =>
                                        {
                                            if n == &"serde" {
                                                vals.iter().map(|mi|
                                                                    match mi.node
                                                                        {
                                                                        ast::MetaItem_::MetaWord(ref n)
                                                                        => {
                                                                            n
                                                                                ==
                                                                                &"default"
                                                                        }
                                                                        _ => {
                                                                            false
                                                                        }
                                                                    }).any(|x|
                                                                               x)
                                            } else { false }
                                        }
                                        _ => { false }
                                    } })
    }
}
#[plugin_registrar]
#[doc(hidden)]
pub fn plugin_registrar(reg: &mut Registry) {
    reg.register_syntax_extension(token::intern("derive_serialize"),
                                  Decorator(Box::new(ser::expand_derive_serialize)));
    reg.register_syntax_extension(token::intern("derive_deserialize"),
                                  Decorator(Box::new(de::expand_derive_deserialize)));
}