minidom: Add a blanket impl for From<Into<Element>> for Node.

This commit is contained in:
Emmanuel Gil Peyrot 2019-11-03 18:49:11 +01:00
parent a1489a6428
commit 877d5c21da
2 changed files with 5 additions and 37 deletions

View file

@ -182,9 +182,11 @@ impl Node {
} }
} }
impl From<Element> for Node { impl<I> From<I> for Node
fn from(elm: Element) -> Node { where I: Into<Element>
Node::Element(elm) {
fn from(elm: I) -> Node {
Node::Element(elm.into())
} }
} }

View file

@ -260,11 +260,6 @@ macro_rules! generate_element_enum {
.build() .build()
} }
} }
impl From<$elem> for ::minidom::Node {
fn from(elem: $elem) -> ::minidom::Node {
::minidom::Node::Element(elem.into())
}
}
); );
} }
@ -303,11 +298,6 @@ macro_rules! generate_attribute_enum {
.build() .build()
} }
} }
impl From<$elem> for ::minidom::Node {
fn from(elem: $elem) -> ::minidom::Node {
::minidom::Node::Element(elem.into())
}
}
); );
} }
@ -402,12 +392,6 @@ macro_rules! generate_empty_element {
.build() .build()
} }
} }
impl From<$elem> for ::minidom::Node {
fn from(elem: $elem) -> ::minidom::Node {
::minidom::Node::Element(elem.into())
}
}
); );
} }
@ -464,12 +448,6 @@ macro_rules! generate_elem_id {
.build() .build()
} }
} }
impl From<$elem> for ::minidom::Node {
fn from(elem: $elem) -> ::minidom::Node {
::minidom::Node::Element(elem.into())
}
}
); );
} }
@ -735,12 +713,6 @@ macro_rules! generate_element {
builder.build() builder.build()
} }
} }
impl From<$elem> for ::minidom::Node {
fn from(elem: $elem) -> ::minidom::Node {
::minidom::Node::Element(elem.into())
}
}
); );
} }
@ -786,12 +758,6 @@ macro_rules! impl_pubsub_item {
} }
} }
impl From<$item> for ::minidom::Node {
fn from(item: $item) -> ::minidom::Node {
::minidom::Node::Element(item.into())
}
}
impl ::std::ops::Deref for $item { impl ::std::ops::Deref for $item {
type Target = crate::pubsub::Item; type Target = crate::pubsub::Item;