use std::path::Path; use serde::Serialize; use crate::config::Config; use crate::error::CustomError; use crate::intermediate::IRegularLink; use super::RenderObject; #[derive(Debug, Serialize)] #[serde(tag = "type")] #[serde(rename = "regular_link")] pub(crate) struct RenderRegularLink { raw_link: String, children: Vec, } impl RenderRegularLink { pub(crate) fn new( config: &Config, output_directory: &Path, output_file: &Path, regular_link: &IRegularLink, ) -> Result { let children = { let mut ret = Vec::new(); for obj in regular_link.children.iter() { ret.push(RenderObject::new( config, &output_directory, &output_file, obj, )?); } ret }; Ok(RenderRegularLink { raw_link: regular_link.raw_link.clone(), children, }) } }