From 265afe7eebbdc6ecc09f25bd283697f3b8742f09 Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Sat, 11 Apr 2020 18:49:47 -0400 Subject: [PATCH] I think I figured out how to get the Index trait back into the generic type. --- src/renderer/renderer.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/renderer/renderer.rs b/src/renderer/renderer.rs index 9679727..3923dab 100644 --- a/src/renderer/renderer.rs +++ b/src/renderer/renderer.rs @@ -43,9 +43,9 @@ impl<'a> DustRenderer<'a> { .insert(template.name.clone(), &template.template); } - pub fn render(&self, name: &str, context: C) -> Result + pub fn render(&self, name: &str, context: &C) -> Result where - C: Copy, + C: Index<&'a str>, { let main_template = match self.templates.get(name) { Some(tmpl) => tmpl, @@ -58,9 +58,9 @@ impl<'a> DustRenderer<'a> { self.render_template(main_template, context) } - fn render_template(&self, template: &Template, context: C) -> Result + fn render_template(&self, template: &Template, context: &C) -> Result where - C: Copy, + C: Index<&'a str>, { let mut output = String::new(); for elem in &template.contents.elements { @@ -74,9 +74,9 @@ impl<'a> DustRenderer<'a> { Ok(output) } - fn render_tag(&self, tag: &DustTag, context: C) -> Result + fn render_tag(&self, tag: &DustTag, context: &C) -> Result where - C: Copy, + C: Index<&'a str>, { match tag { DustTag::DTComment(comment) => (),