fn saveload_struct(
    data: &mut DataStruct,
    name: &mut Ident,
    generics: &mut Generics,
) -> SaveloadDerive {
    use syn::Fields;

    let mut saveload_generics = generics.clone();
    saveload_generics.params.push(parse_quote!(MA));

    let saveload_name = Ident::new(&format!("{}SaveloadData", name), Span::call_site());

    let saveload_fields = convert_fields_to_metadata(&data.fields);

    let (struct_def, ser, de) = if let Fields::Named(_) = data.fields {
        saveload_named_struct(&name, &saveload_name, &saveload_generics, &saveload_fields)
    } else if let Fields::Unnamed(_) = data.fields {
        saveload_tuple_struct(
            data,
            &name,
            &saveload_name,
            &saveload_generics,
            &saveload_fields,
        )
    } else {
        panic!(
            "Every unit struct `Serialize`/`Deserialize` thus blanket impl already implements `ConvertSaveload` for them."
        );
    };

    SaveloadDerive {
        type_def: struct_def,
        ser,
        de,
        saveload_name,
    }
}
/// Implements all elements of saveload common to structs of any type
Implements all elements of saveload common to structs of any type
Implements all elements of saveload common to structs of any type
fn saveload_struct(
    data: &mut DataStruct,
    name: &mut Ident,
    generics: &mut Generics,
) -> SaveloadDerive {
    use syn::Fields;
    let mut saveload_generics = generics.clone();
    saveload_generics.params.push(parse_quote!(MA));
    let saveload_name = Ident::new(&format!("{}SaveloadData", name), Span::call_site());
    let saveload_fields = convert_fields_to_metadata(&data.fields);
    let (struct_def, ser, de) = if let Fields::Named(_) = data.fields {
        saveload_named_struct(&name, &saveload_name, &saveload_generics, &saveload_fields)
    } else if let Fields::Unnamed(_) = data.fields {
        saveload_tuple_struct(
            data,
            &name,
            &saveload_name,
            &saveload_generics,
            &saveload_fields,
        )
    } else {
        panic!(
            "Every unit struct `Serialize`/`Deserialize` thus blanket impl already implements `ConvertSaveload` for them."
        );
    };
    SaveloadDerive {
        type_def: struct_def,
        ser,
        de,
        saveload_name,
    }
}
fn saveload_struct ( data : & mut DataStruct , name : & mut Ident , generics : & mut Generics , ) -> SaveloadDerive { use syn :: Fields ; let mut saveload_generics = generics . clone ( ) ; saveload_generics . params . push ( parse_quote ! ( MA ) ) ; let saveload_name = Ident :: new ( & format ! ( " " name ) , Span :: call_site ( ) ) ; let saveload_fields = convert_fields_to_metadata ( & data . fields ) ; let ( struct_def , ser , de ) = if let Fields :: Named ( _ ) = data . fields { saveload_named_struct ( & name , & saveload_name , & saveload_generics , & saveload_fields ) } else if let Fields :: Unnamed ( _ ) = data . fields { saveload_tuple_struct ( data , & name , & saveload_name , & saveload_generics , & saveload_fields , ) } else { panic ! ( " " ) ; } ; SaveloadDerive { type_def : struct_def , ser , de , saveload_name , } }
Implements all elements of saveload common to structs of any type
Implements all elements of saveload common to structs of any type
data
&mut DataStruct
name
&mut Ident
generics
&mut Generics