Avoid closures for the intermediate macro.

This commit is contained in:
Tom Alexander
2023-10-29 18:35:42 -04:00
parent 3d44d20384
commit 24b9782146
16 changed files with 40 additions and 51 deletions

View File

@@ -23,13 +23,15 @@ pub(crate) use inoop;
///
/// This exists to make changing the type signature easier.
macro_rules! intermediate {
($istruct:ident, $pstruct:ident, $fnbody:expr) => {
($istruct:ident, $pstruct:ident, $original:ident, $registry:ident, $fnbody:tt) => {
impl $istruct {
pub(crate) async fn new<'reg, 'orig, 'parse>(
registry: &'reg mut Registry<'orig, 'parse>,
original: &'orig organic::types::$pstruct<'parse>,
) -> Result<$istruct, CustomError> {
$fnbody(registry, original).await
let $original = original;
let $registry = registry;
$fnbody
}
}
};