manual_flag should only check the first struct field
This commit is contained in:
parent
ed16a717f6
commit
b692b8b417
@ -374,26 +374,18 @@ pub fn pso_packet(attr: TokenStream, item: TokenStream) -> TokenStream {
|
|||||||
};
|
};
|
||||||
|
|
||||||
if manual_flag {
|
if manual_flag {
|
||||||
let mut found_flag = false;
|
match &attrs[0] {
|
||||||
for attr in attrs.iter() {
|
AttrType::Array(_, ident, _, _) => {
|
||||||
match attr {
|
if ident.to_string() != "flag" {
|
||||||
AttrType::Array(_, ident, _, _) => {
|
return syn::Error::new(pkt_struct.ident.span(), "struct must have flag as the first field if manual_flag is set").to_compile_error().into();
|
||||||
if ident.to_string() == "flag" {
|
}
|
||||||
found_flag = true;
|
},
|
||||||
break;
|
AttrType::Value(_, ident, _) => {
|
||||||
}
|
if ident.to_string() != "flag" {
|
||||||
},
|
return syn::Error::new(pkt_struct.ident.span(), "struct must have flag as the first field if manual_flag is set").to_compile_error().into();
|
||||||
AttrType::Value(_, ident, _) => {
|
|
||||||
if ident.to_string() == "flag" {
|
|
||||||
found_flag = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if !found_flag {
|
|
||||||
return syn::Error::new(pkt_struct.ident.span(), "struct must have flag if manual_flag is set").to_compile_error().into();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let struct_def = generate_struct_def(pkt_struct.ident.clone(), &attrs);
|
let struct_def = generate_struct_def(pkt_struct.ident.clone(), &attrs);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user