Add codegen for new rust yunq parser.

This commit is contained in:
Drew Galbraith 2024-07-27 20:23:03 -07:00
parent 8f35d38e93
commit 2cbf871d09
8 changed files with 261 additions and 96 deletions

View file

@ -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());
}