use std::borrow::Cow;
pub use textus_derive::Template;
pub trait Template {
fn render(&self) -> Vec<(&'static str, Cow<'static, str>)>;
fn render_into(&self, target: &std::path::Path) -> std::io::Result<()> {
for (rel_path, content) in self.render() {
let abs = target.join(rel_path);
if let Some(parent) = abs.parent() {
std::fs::create_dir_all(parent)?;
}
std::fs::write(abs, content.as_ref())?;
}
Ok(())
}
}