I think I figured out how to get the Index trait back into the generic type.
This commit is contained in:
		
							parent
							
								
									f65a144b3c
								
							
						
					
					
						commit
						265afe7eeb
					
				| @ -43,9 +43,9 @@ impl<'a> DustRenderer<'a> { | ||||
|             .insert(template.name.clone(), &template.template); | ||||
|     } | ||||
| 
 | ||||
|     pub fn render<C>(&self, name: &str, context: C) -> Result<String, RenderError> | ||||
|     pub fn render<C>(&self, name: &str, context: &C) -> Result<String, RenderError> | ||||
|     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<C>(&self, template: &Template, context: C) -> Result<String, RenderError> | ||||
|     fn render_template<C>(&self, template: &Template, context: &C) -> Result<String, RenderError> | ||||
|     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<C>(&self, tag: &DustTag, context: C) -> Result<String, RenderError> | ||||
|     fn render_tag<C>(&self, tag: &DustTag, context: &C) -> Result<String, RenderError> | ||||
|     where | ||||
|         C: Copy, | ||||
|         C: Index<&'a str>, | ||||
|     { | ||||
|         match tag { | ||||
|             DustTag::DTComment(comment) => (), | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Tom Alexander
						Tom Alexander