fn deepsize_sum(data: &Data, struct_name: &proc_macro2::Ident) -> TokenStream {
    match *data {
        Data::Struct(ref inner) => {
            match_fields(&inner.fields)
        }
        Data::Enum(ref inner) => {
            let arms = inner.variants.iter()
                .map(|var| {
                    let matcher = get_matcher(var);
                    let output = match_enum_fields(&var.fields);
                    let name = &var.ident;
                    let ident = quote!(#struct_name::#name);
                    quote!(#ident #matcher => #output,)
                });

            quote! {
                match self {
                    #(#arms)*
                    _ => 0 // This is needed for empty enums
                }
            }
        }
        Data::Union(_) => unimplemented!(),
    }
}
/// Generate an expression to sum up the size of each field.
Generate an expression to sum up the size of each field.
Generate an expression to sum up the size of each field .
fn deepsize_sum(data: &Data, struct_name: &proc_macro2::Ident) -> TokenStream {
    match *data {
        Data::Struct(ref inner) => {
            match_fields(&inner.fields)
        }
        Data::Enum(ref inner) => {
            let arms = inner.variants.iter()
                .map(|var| {
                    let matcher = get_matcher(var);
                    let output = match_enum_fields(&var.fields);
                    let name = &var.ident;
                    let ident = quote!(#struct_name::#name);
                    quote!(#ident #matcher => #output,)
                });
            quote! {
                match self {
                    #(#arms)*
                    _ => 0 // This is needed for empty enums
                }
            }
        }
        Data::Union(_) => unimplemented!(),
    }
}
fn deepsize_sum ( data : & Data , struct_name : & proc_macro2 :: Ident ) -> TokenStream { match * data { Data :: Struct ( ref inner ) => { match_fields ( & inner . fields ) } Data :: Enum ( ref inner ) => { let arms = inner . variants . iter ( ) . map ( | var | { let matcher = get_matcher ( var ) ; let output = match_enum_fields ( & var . fields ) ; let name = & var . ident ; let ident = quote ! ( struct_name name ) ; quote ! ( ident matcher output ) } ) ; quote ! { match self { ( arms ) 0 // This is needed for empty enums } } } Data :: Union ( _ ) => unimplemented ! ( ) , } }
Generate an expression to sum up the size of each field.
Generate an expression to sum up the size of each field .
data
&Data
struct_name
&proc_macro2::Ident
data
&Data
struct_name
&proc_macro2::Ident