use std::path::Path; use serde::Serialize; use crate::config::Config; use crate::error::CustomError; use crate::intermediate::ISection; use super::RenderElement; #[derive(Debug, Serialize)] #[serde(tag = "type")] #[serde(rename = "section")] pub(crate) struct RenderSection { children: Vec, } impl RenderSection { pub(crate) fn new, F: AsRef>( config: &Config, output_directory: D, output_file: F, section: &ISection, ) -> Result { let children = section .children .iter() .map(|obj| RenderElement::new(config, &output_directory, &output_file, obj)) .collect::, _>>()?; Ok(RenderSection { children }) } }