Add codegen for new rust yunq parser.
This commit is contained in:
parent
8f35d38e93
commit
2cbf871d09
8 changed files with 261 additions and 96 deletions
|
|
@ -26,6 +26,12 @@ fn serialize_field(name: &Ident, ind: usize, path: &Path) -> proc_macro2::TokenS
|
|||
buf.write_at(yunq::message::field_offset(offset, #ind), cap_ind as u64)?;
|
||||
}
|
||||
}
|
||||
} else if path.is_ident("u64") {
|
||||
quote! {
|
||||
{
|
||||
buf.write_at(yunq::message::field_offset(offset, #ind), self.#name as u64)?;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
panic!(
|
||||
"Serialization not implemented for: {}",
|
||||
|
|
@ -51,6 +57,10 @@ fn parse_field(name: &Ident, ind: usize, path: &Path) -> proc_macro2::TokenStrea
|
|||
caps[cap_ind as usize]
|
||||
};
|
||||
}
|
||||
} else if path.is_ident("u64") {
|
||||
quote! {
|
||||
let #name = buf.at::<u64>(yunq::message::field_offset(offset, #ind))?;
|
||||
}
|
||||
} else {
|
||||
panic!("Parsing not implemented for: {}", path.into_token_stream());
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue