serde_macros 0.3.3

Macros to auto-generate implementations for the serde framework
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
b0VIM 7.46��T�Ν&ericktErick-Tryzelaar-MBP.local~erickt/projects/rust/rust-serde/serde2/serde2_macros/src/lib.rs
3210#"! Utpw��������}x��������p����������em�adD<w��������zp`RO>#����|m`L8&�
�
�
�
�
�
�
u
k
b
V
I
-
*

�������i<	��vkih7
�
�
p
N
L

�	�	�	�	�	H	!	����}R0���fD"���\�uN%����fJ1����]F3���}<;                        ],                                  box Literal(Path::new_local("__R")),                        vec![                        None,                        vec!("std", "result", "Result"),                    Path::new_(                ret_ty: Literal(                ],                    ),                        Path::new_local("__V"),                    Literal(                    ),                        Borrowed(None, MutMutable)                        box Literal(Path::new_local("__S")),                    Ptr(                args: vec![                explicit_self: borrowed_explicit_self(),                },                    ]                        ),                            ],                                ),                                    true                                    ],                                        box Literal(Path::new_local("__E")),                                        box Literal(Path::new_local("__R")),                                        box Literal(Path::new_local("__S")),                                    vec![                                    None,                                    vec!["serde2", "ser", "Visitor"],                                Path::new_(                            vec![                            None,                            "__V",                        (                        ("__E", None, vec![]),                        ("__R", None, vec![]),                        ("__S", None, vec![]),                    bounds: vec![                    lifetimes: Vec::new(),                generics: LifetimeBounds {                name: "visit",            MethodDef {        methods: vec![        generics: LifetimeBounds::empty(),        additional_bounds: Vec::new(),        path: Path::new(vec!["serde2", "ser", "Serialize"]),        attributes: vec!(),        span: sp,    let trait_def = TraitDef {    let attrs = vec!(cx.attribute(sp, inline));    let inline = cx.meta_word(sp, token::InternedString::new("inline"));{        //F: FnOnce(P<ast::Item>)                                push: |P<ast::Item>|) //where                                item: &Item,                                mitem: &MetaItem,                                sp: Span,fn expand_deriving_serialize<>(cx: &mut ExtCtxt,}        */        ItemDecorator(box expand_deriving_deserialize));        token::intern("deriving_deserialize"),    reg.register_syntax_extension(    /*        Decorator(box expand_deriving_serialize));        token::intern("deriving_serialize"),    reg.register_syntax_extension(pub fn plugin_registrar(reg: &mut Registry) {#[doc(hidden)]#[plugin_registrar]use rustc::plugin::Registry;use syntax::ptr::P;use syntax::parse::token;};    borrowed_explicit_self,    //Tuple,    //Self,    Ptr,    Path,    Literal,    LifetimeBounds,    Borrowed,use syntax::ext::deriving::generic::ty::{};    combine_substructure,    //Unnamed,    TraitDef,    Substructure,    Struct,    //StaticEnum,    //StaticStruct,    //StaticFields,    //Named,    MethodDef,    FieldInfo,    EnumMatching,use syntax::ext::deriving::generic::{use syntax::ext::build::AstBuilder;use syntax::ext::base::{ExtCtxt, Decorator, ItemDecorator};use syntax::codemap::Span;use syntax::ast;};    //LitNil,    MutMutable,    Expr,    Item,    MetaItem,    Ident,use syntax::ast::{extern crate rustc;extern crate syntax;#![feature(plugin_registrar, quote)]ad�Vm��~bD'��������|jZC�
�
�
�
�
d
B


�����zK����WE65�
�
�
�

`
N
*


�	�	�	�	�	�	�	U		�����ZK7���_C'	��~};-#��dL2����ka[YVU*/}    }        }            cx.expr_struct_ident(span, outer_pat_ident, fields)            }).collect();                cx.field_imm(span, name, arg)                );                    token::get_ident(name)                    span,                    cx,                let arg = getarg(            let fields = fields.iter().map(|&(name, span)| {            // use the field's span to get nicer error messages.        Named(ref fields) => {        }            }                cx.expr_call_ident(span, outer_pat_ident, fields)                }).collect();                    )                        token::intern_and_get_ident(format!("_field{}", i).as_slice())                        span,                        cx,                    getarg(                let fields = fields.iter().enumerate().map(|(i, &span)| {            } else {                cx.expr_ident(span, outer_pat_ident)            if fields.is_empty() {        Unnamed(ref fields) => {    match *fields {) -> P<Expr> {    getarg: |&ExtCtxt, Span, token::InternedString| -> P<Expr>    fields: &StaticFields,    outer_pat_ident: Ident,    span: Span,    cx: &ExtCtxt,fn deserialize_static_fields(/// - `getarg` should retrieve the `uint`-th field with name `&str`./// - `outer_pat_ident` is the name of this enum variant/struct/// Create a deserializer for a single enum variant/struct:}    })        Ok(result)        try!($deserializer.expect_enum_end());        };            _ => { unreachable!() }            $arms        let result = match i {        let i = try!($deserializer.expect_enum_start($token, $type_name, $variants));    quote_expr!(cx, {        .collect();        })            quote_arm!(cx, $i => $call,)            );                }                    quote_expr!(cx, try!($deserializer.expect_enum_elt()))                |cx, span, _| {                parts,                name,                span,                cx,            let call = deserialize_static_fields(        .map(|(i, &(name, span, ref parts))| {        .enumerate()    let arms: Vec<ast::Arm> = fields.iter()    let variants = cx.expr_vec(span, variants);        .collect();        })            cx.expr_str(span, token::get_ident(name))        .map(|&(name, span, _)| {    let variants = fields.iter()    let type_name = cx.expr_str(span, token::get_ident(type_ident));) -> P<ast::Expr> {    token: P<ast::Expr>    deserializer: P<ast::Expr>,    fields: &[(Ident, Span, StaticFields)],    type_ident: Ident,    span: Span,    cx: &ExtCtxt,fn deserialize_enum(}    })        Ok($result)        $extract_fields        }            try!($deserializer.ignore_field(token))            }                }                    _ => { }                    $key_arms                match key {                };                    }                        return Err($deserializer.syntax_error(token, expected_tokens));