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 {
fn from(elm: Element) -> Node {
Node::Element(elm)
impl<I> From<I> for Node
where I: Into<Element>
{
fn from(elm: I) -> Node {
Node::Element(elm.into())
}
}

View file

@ -260,11 +260,6 @@ macro_rules! generate_element_enum {
.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()
}
}
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()
}
}
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()
}
}
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()
}
}
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 {
type Target = crate::pubsub::Item;