2023-10-31 19:14:36 -04:00
|
|
|
/// Write the implementation for the render ast node.
|
|
|
|
|
///
|
|
|
|
|
/// This exists to make changing the type signature easier.
|
|
|
|
|
macro_rules! render {
|
2023-12-19 15:42:37 -05:00
|
|
|
($rstruct:ident, $istruct:ident, $original:ident, $render_context:ident, $fnbody:tt) => {
|
2023-10-31 19:14:36 -04:00
|
|
|
impl $rstruct {
|
|
|
|
|
pub(crate) fn new(
|
2023-12-19 15:42:37 -05:00
|
|
|
render_context: RenderContext<'_>,
|
2023-10-31 19:14:36 -04:00
|
|
|
original: &$istruct,
|
|
|
|
|
) -> Result<$rstruct, CustomError> {
|
|
|
|
|
let $original = original;
|
2023-12-19 15:42:37 -05:00
|
|
|
let $render_context = render_context;
|
2023-10-31 19:14:36 -04:00
|
|
|
$fnbody
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub(crate) use render;
|
|
|
|
|
|
|
|
|
|
/// Write the implementation for a render ast node that has no fields.
|
|
|
|
|
///
|
|
|
|
|
/// This exists to make changing the type signature easier.
|
|
|
|
|
macro_rules! rnoop {
|
|
|
|
|
($rstruct:ident, $istruct:ident) => {
|
|
|
|
|
impl $rstruct {
|
|
|
|
|
pub(crate) fn new(
|
2023-12-19 15:42:37 -05:00
|
|
|
_render_context: RenderContext<'_>,
|
2023-10-31 19:14:36 -04:00
|
|
|
_original: &$istruct,
|
|
|
|
|
) -> Result<$rstruct, CustomError> {
|
|
|
|
|
Ok($rstruct {})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub(crate) use rnoop;
|