mirror of
https://gitlab.com/xmpp-rs/xmpp-rs.git
synced 2024-07-01 02:48:42 +02:00
macros: Remove use requirement on minidom::Element.
This commit is contained in:
parent
0d4327eb42
commit
6f497027f5
|
@ -4,8 +4,6 @@
|
|||
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
use minidom::Element;
|
||||
|
||||
use error::Error;
|
||||
|
||||
use ns;
|
||||
|
@ -16,6 +14,7 @@ generate_empty_element!(Attention, "attention", ns::ATTENTION);
|
|||
mod tests {
|
||||
use super::*;
|
||||
use try_from::TryFrom;
|
||||
use minidom::Element;
|
||||
|
||||
#[test]
|
||||
fn test_simple() {
|
||||
|
|
|
@ -6,8 +6,6 @@
|
|||
|
||||
#![deny(missing_docs)]
|
||||
|
||||
use minidom::Element;
|
||||
|
||||
use error::Error;
|
||||
|
||||
use ns;
|
||||
|
@ -37,6 +35,7 @@ generate_element_enum!(
|
|||
mod tests {
|
||||
use super::*;
|
||||
use try_from::TryFrom;
|
||||
use minidom::Element;
|
||||
|
||||
#[test]
|
||||
fn test_simple() {
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
use minidom::Element;
|
||||
use error::Error;
|
||||
use helpers::PlainText;
|
||||
use ns;
|
||||
|
@ -37,6 +36,7 @@ impl Handshake {
|
|||
mod tests {
|
||||
use super::*;
|
||||
use try_from::TryFrom;
|
||||
use minidom::Element;
|
||||
|
||||
#[test]
|
||||
fn test_simple() {
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
use minidom::Element;
|
||||
use date::DateTime;
|
||||
|
||||
use error::Error;
|
||||
|
@ -25,6 +24,7 @@ generate_element_with_text!(Delay, "delay", ns::DELAY,
|
|||
mod tests {
|
||||
use super::*;
|
||||
use try_from::TryFrom;
|
||||
use minidom::Element;
|
||||
use std::str::FromStr;
|
||||
|
||||
#[test]
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
use minidom::Element;
|
||||
|
||||
use error::Error;
|
||||
|
||||
use ns;
|
||||
|
@ -25,6 +23,7 @@ ExplicitMessageEncryption, "encryption", ns::EME, [
|
|||
mod tests {
|
||||
use super::*;
|
||||
use try_from::TryFrom;
|
||||
use minidom::Element;
|
||||
|
||||
#[test]
|
||||
fn test_simple() {
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
use std::str::FromStr;
|
||||
|
||||
use minidom::{Element, IntoAttributeValue};
|
||||
use minidom::IntoAttributeValue;
|
||||
|
||||
use error::Error;
|
||||
|
||||
|
@ -93,6 +93,7 @@ impl Hash {
|
|||
mod tests {
|
||||
use super::*;
|
||||
use try_from::TryFrom;
|
||||
use minidom::Element;
|
||||
|
||||
#[test]
|
||||
fn test_simple() {
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
use minidom::Element;
|
||||
|
||||
use error::Error;
|
||||
|
||||
use ns;
|
||||
|
@ -38,6 +36,7 @@ generate_element_with_only_attributes!(Close, "close", ns::IBB, [
|
|||
mod tests {
|
||||
use super::*;
|
||||
use try_from::TryFrom;
|
||||
use minidom::Element;
|
||||
use std::error::Error as StdError;
|
||||
|
||||
#[test]
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
use minidom::Element;
|
||||
use date::DateTime;
|
||||
|
||||
use error::Error;
|
||||
|
@ -19,6 +18,7 @@ generate_element_with_only_attributes!(Idle, "idle", ns::IDLE, [
|
|||
mod tests {
|
||||
use super::*;
|
||||
use try_from::TryFrom;
|
||||
use minidom::Element;
|
||||
use std::str::FromStr;
|
||||
use std::error::Error as StdError;
|
||||
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
use minidom::Element;
|
||||
|
||||
use error::Error;
|
||||
|
||||
use ns;
|
||||
|
@ -24,6 +22,7 @@ generate_element_with_only_attributes!(Transport, "transport", ns::JINGLE_IBB, [
|
|||
mod tests {
|
||||
use super::*;
|
||||
use try_from::TryFrom;
|
||||
use minidom::Element;
|
||||
use std::error::Error as StdError;
|
||||
|
||||
#[test]
|
||||
|
|
|
@ -116,9 +116,9 @@ macro_rules! generate_element_enum {
|
|||
$enum
|
||||
),+
|
||||
}
|
||||
impl ::try_from::TryFrom<Element> for $elem {
|
||||
impl ::try_from::TryFrom<::minidom::Element> for $elem {
|
||||
type Err = Error;
|
||||
fn try_from(elem: Element) -> Result<$elem, Error> {
|
||||
fn try_from(elem: ::minidom::Element) -> Result<$elem, Error> {
|
||||
check_ns_only!(elem, $name, $ns);
|
||||
check_no_children!(elem, $name);
|
||||
check_no_attributes!(elem, $name);
|
||||
|
@ -128,9 +128,9 @@ macro_rules! generate_element_enum {
|
|||
})
|
||||
}
|
||||
}
|
||||
impl From<$elem> for Element {
|
||||
fn from(elem: $elem) -> Element {
|
||||
Element::builder(match elem {
|
||||
impl From<$elem> for ::minidom::Element {
|
||||
fn from(elem: $elem) -> ::minidom::Element {
|
||||
::minidom::Element::builder(match elem {
|
||||
$($elem::$enum => $enum_name,)+
|
||||
}).ns($ns)
|
||||
.build()
|
||||
|
@ -152,9 +152,9 @@ macro_rules! generate_attribute_enum {
|
|||
$enum
|
||||
),+
|
||||
}
|
||||
impl ::try_from::TryFrom<Element> for $elem {
|
||||
impl ::try_from::TryFrom<::minidom::Element> for $elem {
|
||||
type Err = Error;
|
||||
fn try_from(elem: Element) -> Result<$elem, Error> {
|
||||
fn try_from(elem: ::minidom::Element) -> Result<$elem, Error> {
|
||||
check_ns_only!(elem, $name, $ns);
|
||||
check_no_children!(elem, $name);
|
||||
check_no_unknown_attributes!(elem, $name, [$attr]);
|
||||
|
@ -164,9 +164,9 @@ macro_rules! generate_attribute_enum {
|
|||
})
|
||||
}
|
||||
}
|
||||
impl From<$elem> for Element {
|
||||
fn from(elem: $elem) -> Element {
|
||||
Element::builder($name)
|
||||
impl From<$elem> for ::minidom::Element {
|
||||
fn from(elem: $elem) -> ::minidom::Element {
|
||||
::minidom::Element::builder($name)
|
||||
.ns($ns)
|
||||
.attr($attr, match elem {
|
||||
$($elem::$enum => $enum_name,)+
|
||||
|
@ -231,10 +231,10 @@ macro_rules! generate_empty_element {
|
|||
#[derive(Debug, Clone)]
|
||||
pub struct $elem;
|
||||
|
||||
impl ::try_from::TryFrom<Element> for $elem {
|
||||
impl ::try_from::TryFrom<::minidom::Element> for $elem {
|
||||
type Err = Error;
|
||||
|
||||
fn try_from(elem: Element) -> Result<$elem, Error> {
|
||||
fn try_from(elem: ::minidom::Element) -> Result<$elem, Error> {
|
||||
check_self!(elem, $name, $ns);
|
||||
check_no_children!(elem, $name);
|
||||
check_no_attributes!(elem, $name);
|
||||
|
@ -242,9 +242,9 @@ macro_rules! generate_empty_element {
|
|||
}
|
||||
}
|
||||
|
||||
impl From<$elem> for Element {
|
||||
fn from(_: $elem) -> Element {
|
||||
Element::builder($name)
|
||||
impl From<$elem> for ::minidom::Element {
|
||||
fn from(_: $elem) -> ::minidom::Element {
|
||||
::minidom::Element::builder($name)
|
||||
.ns($ns)
|
||||
.build()
|
||||
}
|
||||
|
@ -266,10 +266,10 @@ macro_rules! generate_element_with_only_attributes {
|
|||
)*
|
||||
}
|
||||
|
||||
impl ::try_from::TryFrom<Element> for $elem {
|
||||
impl ::try_from::TryFrom<::minidom::Element> for $elem {
|
||||
type Err = Error;
|
||||
|
||||
fn try_from(elem: Element) -> Result<$elem, Error> {
|
||||
fn try_from(elem: ::minidom::Element) -> Result<$elem, Error> {
|
||||
check_self!(elem, $name, $ns);
|
||||
check_no_children!(elem, $name);
|
||||
check_no_unknown_attributes!(elem, $name, [$($attr_name),*]);
|
||||
|
@ -281,9 +281,9 @@ macro_rules! generate_element_with_only_attributes {
|
|||
}
|
||||
}
|
||||
|
||||
impl From<$elem> for Element {
|
||||
fn from(elem: $elem) -> Element {
|
||||
Element::builder($name)
|
||||
impl From<$elem> for ::minidom::Element {
|
||||
fn from(elem: $elem) -> ::minidom::Element {
|
||||
::minidom::Element::builder($name)
|
||||
.ns($ns)
|
||||
$(
|
||||
.attr($attr_name, elem.$attr)
|
||||
|
@ -324,9 +324,9 @@ macro_rules! generate_elem_id {
|
|||
Ok($elem(String::from(s)))
|
||||
}
|
||||
}
|
||||
impl ::try_from::TryFrom<Element> for $elem {
|
||||
impl ::try_from::TryFrom<::minidom::Element> for $elem {
|
||||
type Err = Error;
|
||||
fn try_from(elem: Element) -> Result<$elem, Error> {
|
||||
fn try_from(elem: ::minidom::Element) -> Result<$elem, Error> {
|
||||
check_self!(elem, $name, $ns);
|
||||
check_no_children!(elem, $name);
|
||||
check_no_attributes!(elem, $name);
|
||||
|
@ -334,9 +334,9 @@ macro_rules! generate_elem_id {
|
|||
Ok($elem(elem.text()))
|
||||
}
|
||||
}
|
||||
impl From<$elem> for Element {
|
||||
fn from(elem: $elem) -> Element {
|
||||
Element::builder($name)
|
||||
impl From<$elem> for ::minidom::Element {
|
||||
fn from(elem: $elem) -> ::minidom::Element {
|
||||
::minidom::Element::builder($name)
|
||||
.ns($ns)
|
||||
.append(elem.0)
|
||||
.build()
|
||||
|
@ -360,10 +360,10 @@ macro_rules! generate_element_with_text {
|
|||
pub $text_ident: $text_type,
|
||||
}
|
||||
|
||||
impl ::try_from::TryFrom<Element> for $elem {
|
||||
impl ::try_from::TryFrom<::minidom::Element> for $elem {
|
||||
type Err = Error;
|
||||
|
||||
fn try_from(elem: Element) -> Result<$elem, Error> {
|
||||
fn try_from(elem: ::minidom::Element) -> Result<$elem, Error> {
|
||||
check_self!(elem, $name, $ns);
|
||||
check_no_children!(elem, $name);
|
||||
check_no_unknown_attributes!(elem, $name, [$($attr_name),*]);
|
||||
|
@ -376,9 +376,9 @@ macro_rules! generate_element_with_text {
|
|||
}
|
||||
}
|
||||
|
||||
impl From<$elem> for Element {
|
||||
fn from(elem: $elem) -> Element {
|
||||
Element::builder($name)
|
||||
impl From<$elem> for ::minidom::Element {
|
||||
fn from(elem: $elem) -> ::minidom::Element {
|
||||
::minidom::Element::builder($name)
|
||||
.ns($ns)
|
||||
$(
|
||||
.attr($attr_name, elem.$attr)
|
||||
|
@ -405,10 +405,10 @@ macro_rules! generate_element_with_children {
|
|||
)*
|
||||
}
|
||||
|
||||
impl ::try_from::TryFrom<Element> for $elem {
|
||||
impl ::try_from::TryFrom<::minidom::Element> for $elem {
|
||||
type Err = Error;
|
||||
|
||||
fn try_from(elem: Element) -> Result<$elem, Error> {
|
||||
fn try_from(elem: ::minidom::Element) -> Result<$elem, Error> {
|
||||
check_self!(elem, $name, $ns);
|
||||
check_no_unknown_attributes!(elem, $name, [$($attr_name),*]);
|
||||
let mut parsed_children = vec!();
|
||||
|
@ -433,9 +433,9 @@ macro_rules! generate_element_with_children {
|
|||
}
|
||||
}
|
||||
|
||||
impl From<$elem> for Element {
|
||||
fn from(elem: $elem) -> Element {
|
||||
Element::builder($name)
|
||||
impl From<$elem> for ::minidom::Element {
|
||||
fn from(elem: $elem) -> ::minidom::Element {
|
||||
::minidom::Element::builder($name)
|
||||
.ns($ns)
|
||||
$(
|
||||
.attr($attr_name, elem.$attr)
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
use minidom::Element;
|
||||
|
||||
use error::Error;
|
||||
|
||||
use ns;
|
||||
|
@ -32,6 +30,7 @@ generate_element_with_children!(MediaElement, "media", ns::MEDIA_ELEMENT,
|
|||
mod tests {
|
||||
use super::*;
|
||||
use try_from::TryFrom;
|
||||
use minidom::Element;
|
||||
use data_forms::DataForm;
|
||||
use std::error::Error as StdError;
|
||||
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
use minidom::Element;
|
||||
|
||||
use error::Error;
|
||||
|
||||
use ns;
|
||||
|
@ -18,6 +16,7 @@ generate_element_with_only_attributes!(Replace, "replace", ns::MESSAGE_CORRECT,
|
|||
mod tests {
|
||||
use super::*;
|
||||
use try_from::TryFrom;
|
||||
use minidom::Element;
|
||||
|
||||
#[test]
|
||||
fn test_simple() {
|
||||
|
|
|
@ -6,8 +6,6 @@
|
|||
|
||||
#![deny(missing_docs)]
|
||||
|
||||
use minidom::Element;
|
||||
|
||||
use error::Error;
|
||||
|
||||
use ns;
|
||||
|
@ -273,6 +271,7 @@ generate_element_enum!(
|
|||
mod tests {
|
||||
use super::*;
|
||||
use try_from::TryFrom;
|
||||
use minidom::Element;
|
||||
|
||||
#[test]
|
||||
fn test_simple() {
|
||||
|
|
|
@ -5,8 +5,6 @@
|
|||
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
use minidom::Element;
|
||||
|
||||
use error::Error;
|
||||
|
||||
use ns;
|
||||
|
@ -17,6 +15,7 @@ generate_empty_element!(Ping, "ping", ns::PING);
|
|||
mod tests {
|
||||
use super::*;
|
||||
use try_from::TryFrom;
|
||||
use minidom::Element;
|
||||
|
||||
#[test]
|
||||
fn test_simple() {
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
use minidom::Element;
|
||||
|
||||
use error::Error;
|
||||
|
||||
use ns;
|
||||
|
@ -20,6 +18,7 @@ generate_element_with_only_attributes!(Received, "received", ns::RECEIPTS, [
|
|||
mod tests {
|
||||
use super::*;
|
||||
use try_from::TryFrom;
|
||||
use minidom::Element;
|
||||
|
||||
#[test]
|
||||
fn test_simple() {
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
use minidom::Element;
|
||||
use jid::Jid;
|
||||
|
||||
use error::Error;
|
||||
|
@ -62,6 +61,7 @@ generate_element_with_children!(
|
|||
mod tests {
|
||||
use super::*;
|
||||
use try_from::TryFrom;
|
||||
use minidom::Element;
|
||||
use std::str::FromStr;
|
||||
use compare_elements::NamespaceAwareCompare;
|
||||
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
use minidom::Element;
|
||||
|
||||
use error::Error;
|
||||
|
||||
use ns;
|
||||
|
@ -40,6 +38,7 @@ generate_element_with_text!(Success, "success", ns::SASL,
|
|||
mod tests {
|
||||
use super::*;
|
||||
use try_from::TryFrom;
|
||||
use minidom::Element;
|
||||
|
||||
#[test]
|
||||
fn test_simple() {
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
use minidom::Element;
|
||||
use jid::Jid;
|
||||
|
||||
use error::Error;
|
||||
|
@ -24,6 +23,7 @@ generate_element_with_only_attributes!(OriginId, "origin-id", ns::SID, [
|
|||
mod tests {
|
||||
use super::*;
|
||||
use try_from::TryFrom;
|
||||
use minidom::Element;
|
||||
use std::str::FromStr;
|
||||
|
||||
#[test]
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
use minidom::Element;
|
||||
use jid::Jid;
|
||||
use error::Error;
|
||||
use ns;
|
||||
|
@ -55,6 +54,7 @@ impl Stream {
|
|||
mod tests {
|
||||
use super::*;
|
||||
use try_from::TryFrom;
|
||||
use minidom::Element;
|
||||
|
||||
#[test]
|
||||
fn test_simple() {
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
use minidom::Element;
|
||||
use jid::Jid;
|
||||
use error::Error;
|
||||
use ns;
|
||||
|
@ -55,6 +54,7 @@ impl Open {
|
|||
mod tests {
|
||||
use super::*;
|
||||
use try_from::TryFrom;
|
||||
use minidom::Element;
|
||||
|
||||
#[test]
|
||||
fn test_simple() {
|
||||
|
|
Loading…
Reference in New Issue
Block a user