44 lines
1.3 KiB
Rust
44 lines
1.3 KiB
Rust
|
|
/// 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, $config:ident, $output_directory:ident, $output_file:ident, $fnbody:tt) => {
|
||
|
|
impl $rstruct {
|
||
|
|
pub(crate) fn new(
|
||
|
|
config: &Config,
|
||
|
|
output_directory: &Path,
|
||
|
|
output_file: &Path,
|
||
|
|
original: &$istruct,
|
||
|
|
) -> Result<$rstruct, CustomError> {
|
||
|
|
let $original = original;
|
||
|
|
let $config = config;
|
||
|
|
let $output_directory = output_directory;
|
||
|
|
let $output_file = output_file;
|
||
|
|
$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(
|
||
|
|
_config: &Config,
|
||
|
|
_output_directory: &Path,
|
||
|
|
_output_file: &Path,
|
||
|
|
_original: &$istruct,
|
||
|
|
) -> Result<$rstruct, CustomError> {
|
||
|
|
Ok($rstruct {})
|
||
|
|
}
|
||
|
|
}
|
||
|
|
};
|
||
|
|
}
|
||
|
|
|
||
|
|
pub(crate) use rnoop;
|