Files
natter/src/context/macros.rs

38 lines
1.0 KiB
Rust
Raw Normal View History

/// Write the implementation for the render ast node.
///
/// This exists to make changing the type signature easier.
macro_rules! render {
($rstruct:ident, $istruct:ident, $original:ident, $render_context:ident, $fnbody:tt) => {
impl $rstruct {
pub(crate) fn new(
$render_context: RenderContext<'_>,
$original: &$istruct,
) -> Result<$rstruct, CustomError> {
$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(
_render_context: RenderContext<'_>,
2023-12-21 14:56:58 -05:00
original: &$istruct,
) -> Result<$rstruct, CustomError> {
2023-12-21 14:56:58 -05:00
Ok($rstruct {
post_blank: original.post_blank,
})
}
}
};
}
pub(crate) use rnoop;