make the structs public

This commit is contained in:
jake 2019-10-31 22:07:53 -07:00
parent dc3fceef14
commit f15f157c03

View File

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