Make the renderer a bit more generic.

This commit is contained in:
Tom Alexander
2023-10-22 16:40:58 -04:00
parent aed88cf05a
commit fc5342adce
4 changed files with 20 additions and 15 deletions

View File

@@ -1,15 +1,16 @@
use std::path::Path;
use std::path::PathBuf;
use serde::Serialize;
use crate::error::CustomError;
pub trait RendererIntegration {
pub(crate) trait RendererIntegration {
fn load_templates<I, P>(&mut self, dust_templates: I) -> Result<(), CustomError>
where
I: Iterator<Item = P>,
P: Into<PathBuf>;
fn render<P>(&self, context: &str, build_directory: P) -> Result<String, CustomError>
fn render<C>(&self, context: C) -> Result<String, crate::error::CustomError>
where
P: AsRef<Path>;
C: Serialize;
}