28 lines
864 B
Rust
28 lines
864 B
Rust
|
|
use std::path::Path;
|
||
|
|
|
||
|
|
use crate::config::Config;
|
||
|
|
use crate::error::CustomError;
|
||
|
|
|
||
|
|
/// The supporting information used for converting the intermediate representation into the dust context for rendering.
|
||
|
|
#[derive(Debug, Clone)]
|
||
|
|
pub(crate) struct RenderContext<'intermediate> {
|
||
|
|
pub(crate) config: &'intermediate Config,
|
||
|
|
// TODO: Perhaps rename to output_root_directory.
|
||
|
|
pub(crate) output_directory: &'intermediate Path,
|
||
|
|
pub(crate) output_file: &'intermediate Path,
|
||
|
|
}
|
||
|
|
|
||
|
|
impl<'intermediate> RenderContext<'intermediate> {
|
||
|
|
pub(crate) fn new(
|
||
|
|
config: &'intermediate Config,
|
||
|
|
output_directory: &'intermediate Path,
|
||
|
|
output_file: &'intermediate Path,
|
||
|
|
) -> Result<RenderContext<'intermediate>, CustomError> {
|
||
|
|
Ok(RenderContext {
|
||
|
|
config,
|
||
|
|
output_directory,
|
||
|
|
output_file,
|
||
|
|
})
|
||
|
|
}
|
||
|
|
}
|