Make the renderer a bit more generic.
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
use super::renderer_integration::RendererIntegration;
|
||||
use duster::renderer::DustRenderer;
|
||||
use serde::Serialize;
|
||||
|
||||
pub(crate) struct DusterRenderer {}
|
||||
|
||||
@@ -8,17 +10,18 @@ impl RendererIntegration for DusterRenderer {
|
||||
I: Iterator<Item = P>,
|
||||
P: Into<std::path::PathBuf>,
|
||||
{
|
||||
todo!()
|
||||
// TODO
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn render<P>(
|
||||
&self,
|
||||
context: &str,
|
||||
build_directory: P,
|
||||
) -> Result<String, crate::error::CustomError>
|
||||
fn render<C>(&self, context: C) -> Result<String, crate::error::CustomError>
|
||||
where
|
||||
P: AsRef<std::path::Path>,
|
||||
C: Serialize,
|
||||
{
|
||||
todo!()
|
||||
let mut dust_renderer = DustRenderer::new();
|
||||
println!("{}", serde_json::to_string(&context)?);
|
||||
|
||||
// TODO
|
||||
Ok("".to_owned())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
mod duster_renderer;
|
||||
mod renderer_integration;
|
||||
pub(crate) use duster_renderer::DusterRenderer;
|
||||
pub(crate) use renderer_integration::RendererIntegration;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user