Implement a macro for pushing the directory.
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user