Feeding the templates into the renderer integration.

This commit is contained in:
Tom Alexander
2023-10-22 17:31:12 -04:00
parent fc5342adce
commit ce0819e85b
6 changed files with 89 additions and 16 deletions

View File

@@ -4,13 +4,18 @@ use serde::Serialize;
pub(crate) struct DusterRenderer {}
impl DusterRenderer {
pub(crate) fn new() -> DusterRenderer {
DusterRenderer {}
}
}
impl RendererIntegration for DusterRenderer {
fn load_templates<I, P>(&mut self, dust_templates: I) -> Result<(), crate::error::CustomError>
fn load_template<N, C>(&mut self, name: N, contents: C) -> Result<(), crate::error::CustomError>
where
I: Iterator<Item = P>,
P: Into<std::path::PathBuf>,
N: Into<String>,
C: Into<String>,
{
// TODO
Ok(())
}

View File

@@ -1,14 +1,12 @@
use std::path::PathBuf;
use serde::Serialize;
use crate::error::CustomError;
pub(crate) trait RendererIntegration {
fn load_templates<I, P>(&mut self, dust_templates: I) -> Result<(), CustomError>
fn load_template<N, C>(&mut self, name: N, contents: C) -> Result<(), CustomError>
where
I: Iterator<Item = P>,
P: Into<PathBuf>;
N: Into<String>,
C: Into<String>;
fn render<C>(&self, context: C) -> Result<String, crate::error::CustomError>
where