implement IntoElements and IntoAttributeValue for &String

This commit is contained in:
Emmanuel Gil Peyrot 2017-05-21 21:07:37 +01:00
parent cb17ca24c1
commit f4e5f5380e

View file

@ -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<String> {
Some(self.to_owned())
}
}
impl<'a> IntoAttributeValue for &'a str {
fn into_attribute_value(self) -> Option<String> {
Some((*self).to_owned())