Implement a macro for pushing the directory.

This commit is contained in:
Tom Alexander
2025-02-08 18:13:55 -05:00
parent 4e0f66401d
commit 3e952ef0f4
2 changed files with 23 additions and 13 deletions

View File

@@ -35,3 +35,23 @@ macro_rules! rnoop {
}
pub(crate) use rnoop;
/// Push a file onto the render DependencyManager's file stack while inside the code block.
macro_rules! push_file {
($render_context:ident, $path:expr, $body:tt) => {{
$render_context
.dependency_manager
.lock()
.unwrap()
.push_file($path)?;
let ret = (|| $body)();
$render_context
.dependency_manager
.lock()
.unwrap()
.pop_file()?;
ret
}};
}
pub(crate) use push_file;