|
|
@ -32,17 +32,17 @@ fn generate_struct_def(name: syn::Ident, attrs: &Vec<AttrType>) -> proc_macro2:: |
|
|
|
for attr in attrs {
|
|
|
|
let element = match attr {
|
|
|
|
AttrType::Value(ty, name, _) => {
|
|
|
|
quote!(#name: #ty)
|
|
|
|
quote!(pub #name: #ty)
|
|
|
|
},
|
|
|
|
AttrType::Array(ty, name, len, _) => {
|
|
|
|
quote!(#name: [#ty; #len])
|
|
|
|
quote!(pub #name: [#ty; #len])
|
|
|
|
}
|
|
|
|
};
|
|
|
|
struct_def.push(element);
|
|
|
|
}
|
|
|
|
|
|
|
|
quote! {
|
|
|
|
struct #name {
|
|
|
|
pub struct #name {
|
|
|
|
#(#struct_def),*
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -78,7 +78,6 @@ fn generate_psopacket_impl(pkt_cmd: u16, name: syn::Ident, attrs: &Vec<AttrType> |
|
|
|
let mut tmp = Vec::new();
|
|
|
|
|
|
|
|
for _ in 0..flag {
|
|
|
|
//#name: <#ty as PSOPacketData>::from_bytes(&mut cur)?,
|
|
|
|
tmp.push(<#vec_type as PSOPacketData>::from_bytes(&mut cur)?);
|
|
|
|
}
|
|
|
|
tmp
|
|
|
|