Browse Source

make the structs public

pull/3/head
jake 5 years ago
parent
commit
f15f157c03
  1. 7
      psopacket/src/lib.rs

7
psopacket/src/lib.rs

@ -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

Loading…
Cancel
Save