From f4e5f5380ec6dc8e3c54bfc6ed131691ebe7528d Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Sun, 21 May 2017 21:07:37 +0100 Subject: [PATCH] implement IntoElements and IntoAttributeValue for &String --- src/convert.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/convert.rs b/src/convert.rs index 83c18771..f3f2ae09 100644 --- a/src/convert.rs +++ b/src/convert.rs @@ -70,6 +70,12 @@ impl IntoElements for String { } } +impl<'a> IntoElements for &'a String { + fn into_elements(self, emitter: &mut ElementEmitter) { + emitter.append_text_node(self.to_owned()); + } +} + impl<'a> IntoElements for &'a str { fn into_elements(self, emitter: &mut ElementEmitter) { emitter.append_text_node(self.to_owned()); @@ -88,6 +94,12 @@ impl IntoAttributeValue for String { } } +impl<'a> IntoAttributeValue for &'a String { + fn into_attribute_value(self) -> Option { + Some(self.to_owned()) + } +} + impl<'a> IntoAttributeValue for &'a str { fn into_attribute_value(self) -> Option { Some((*self).to_owned())