tokio-xmpp: Import Jid, BareJid and Element properly

Emmanuel Gil Peyrot created

xmpp-parsers has stopped reexporting them, instead it reexports only the
crates themselves.

Change summary

tokio-xmpp/examples/contact_addr.rs     | 3 ++-
tokio-xmpp/examples/download_avatars.rs | 3 ++-
tokio-xmpp/examples/echo_bot.rs         | 3 ++-
tokio-xmpp/examples/echo_component.rs   | 3 ++-
tokio-xmpp/examples/send_message.rs     | 2 +-
tokio-xmpp/src/client/async_client.rs   | 3 ++-
tokio-xmpp/src/client/connect.rs        | 2 +-
tokio-xmpp/src/client/simple_client.rs  | 3 ++-
tokio-xmpp/src/component/connect.rs     | 2 +-
tokio-xmpp/src/component/mod.rs         | 3 ++-
tokio-xmpp/src/connect.rs               | 2 +-
tokio-xmpp/src/error.rs                 | 2 +-
tokio-xmpp/src/event.rs                 | 3 ++-
tokio-xmpp/src/lib.rs                   | 4 ++--
tokio-xmpp/src/starttls/client.rs       | 2 +-
tokio-xmpp/src/starttls/mod.rs          | 3 ++-
tokio-xmpp/src/stream_features.rs       | 3 ++-
tokio-xmpp/src/stream_start.rs          | 3 ++-
tokio-xmpp/src/tcp/mod.rs               | 2 +-
tokio-xmpp/src/xmpp_codec.rs            | 2 +-
tokio-xmpp/src/xmpp_stream.rs           | 3 ++-
21 files changed, 34 insertions(+), 22 deletions(-)

Detailed changes

tokio-xmpp/examples/contact_addr.rs 🔗

@@ -1,4 +1,5 @@
 use futures::stream::StreamExt;
+use minidom::Element;
 use std::env::args;
 use std::process::exit;
 use std::str::FromStr;
@@ -6,9 +7,9 @@ use tokio_xmpp::AsyncClient as Client;
 use xmpp_parsers::{
     disco::{DiscoInfoQuery, DiscoInfoResult},
     iq::{Iq, IqType},
+    jid::{BareJid, Jid},
     ns,
     server_info::ServerInfo,
-    BareJid, Element, Jid,
 };
 
 #[tokio::main]

tokio-xmpp/examples/download_avatars.rs 🔗

@@ -1,4 +1,5 @@
 use futures::stream::StreamExt;
+use minidom::Element;
 use std::env::args;
 use std::fs::{create_dir_all, File};
 use std::io::{self, Write};
@@ -11,6 +12,7 @@ use xmpp_parsers::{
     disco::{DiscoInfoQuery, DiscoInfoResult, Feature, Identity},
     hashes::Algo,
     iq::{Iq, IqType},
+    jid::{BareJid, Jid},
     message::Message,
     ns,
     presence::{Presence, Type as PresenceType},
@@ -20,7 +22,6 @@ use xmpp_parsers::{
         NodeName,
     },
     stanza_error::{DefinedCondition, ErrorType, StanzaError},
-    BareJid, Element, Jid,
 };
 
 #[tokio::main]

tokio-xmpp/examples/echo_bot.rs 🔗

@@ -1,11 +1,12 @@
 use futures::stream::StreamExt;
+use minidom::Element;
 use std::env::args;
 use std::process::exit;
 use std::str::FromStr;
 use tokio_xmpp::AsyncClient as Client;
+use xmpp_parsers::jid::{BareJid, Jid};
 use xmpp_parsers::message::{Body, Message, MessageType};
 use xmpp_parsers::presence::{Presence, Show as PresenceShow, Type as PresenceType};
-use xmpp_parsers::{BareJid, Element, Jid};
 
 #[tokio::main]
 async fn main() {

tokio-xmpp/examples/echo_component.rs 🔗

@@ -1,11 +1,12 @@
 use futures::stream::StreamExt;
+use minidom::Element;
 use std::env::args;
 use std::process::exit;
 use std::str::FromStr;
 use tokio_xmpp::tcp::TcpComponent as Component;
+use xmpp_parsers::jid::Jid;
 use xmpp_parsers::message::{Body, Message, MessageType};
 use xmpp_parsers::presence::{Presence, Show as PresenceShow, Type as PresenceType};
-use xmpp_parsers::{Element, Jid};
 
 #[tokio::main]
 async fn main() {

tokio-xmpp/examples/send_message.rs 🔗

@@ -3,8 +3,8 @@ use std::io::{stdin, Read};
 use std::process::exit;
 use std::str::FromStr;
 use tokio_xmpp::SimpleClient as Client;
+use xmpp_parsers::jid::Jid;
 use xmpp_parsers::message::{Body, Message};
-use xmpp_parsers::Jid;
 
 #[tokio::main]
 async fn main() {

tokio-xmpp/src/client/async_client.rs 🔗

@@ -1,9 +1,10 @@
 use futures::{sink::SinkExt, task::Poll, Future, Sink, Stream};
+use minidom::Element;
 use std::mem::replace;
 use std::pin::Pin;
 use std::task::Context;
 use tokio::task::JoinHandle;
-use xmpp_parsers::{ns, Element, Jid};
+use xmpp_parsers::{jid::Jid, ns};
 
 use super::connect::client_login;
 use crate::connect::{AsyncReadAndWrite, ServerConnector};

tokio-xmpp/src/client/connect.rs 🔗

@@ -1,5 +1,5 @@
 use sasl::common::Credentials;
-use xmpp_parsers::{ns, Jid};
+use xmpp_parsers::{jid::Jid, ns};
 
 use crate::client::auth::auth;
 use crate::client::bind::bind;

tokio-xmpp/src/client/simple_client.rs 🔗

@@ -1,8 +1,9 @@
 use futures::{sink::SinkExt, Sink, Stream};
+use minidom::Element;
 use std::pin::Pin;
 use std::task::{Context, Poll};
 use tokio_stream::StreamExt;
-use xmpp_parsers::{ns, Element, Jid};
+use xmpp_parsers::{jid::Jid, ns};
 
 use crate::connect::ServerConnector;
 use crate::stream_features::StreamFeatures;

tokio-xmpp/src/component/connect.rs 🔗

@@ -1,4 +1,4 @@
-use xmpp_parsers::{ns, Jid};
+use xmpp_parsers::{jid::Jid, ns};
 
 use crate::connect::ServerConnector;
 use crate::{xmpp_stream::XMPPStream, Error};

tokio-xmpp/src/component/mod.rs 🔗

@@ -2,10 +2,11 @@
 //! XMPP server under a JID consisting of just a domain name. They are
 //! allowed to use any user and resource identifiers in their stanzas.
 use futures::{sink::SinkExt, task::Poll, Sink, Stream};
+use minidom::Element;
 use std::pin::Pin;
 use std::str::FromStr;
 use std::task::Context;
-use xmpp_parsers::{ns, Element, Jid};
+use xmpp_parsers::{jid::Jid, ns};
 
 use self::connect::component_login;
 

tokio-xmpp/src/connect.rs 🔗

@@ -2,7 +2,7 @@
 
 use sasl::common::ChannelBinding;
 use tokio::io::{AsyncRead, AsyncWrite};
-use xmpp_parsers::Jid;
+use xmpp_parsers::jid::Jid;
 
 use crate::xmpp_stream::XMPPStream;
 

tokio-xmpp/src/error.rs 🔗

@@ -6,7 +6,7 @@ use std::io::Error as IoError;
 use std::str::Utf8Error;
 
 use xmpp_parsers::sasl::DefinedCondition as SaslDefinedCondition;
-use xmpp_parsers::{Error as ParsersError, JidParseError};
+use xmpp_parsers::{jid::Error as JidParseError, Error as ParsersError};
 
 use crate::connect::ServerConnectorError;
 

tokio-xmpp/src/event.rs 🔗

@@ -1,5 +1,6 @@
 use super::Error;
-use xmpp_parsers::{Element, Jid};
+use minidom::Element;
+use xmpp_parsers::jid::Jid;
 
 /// High-level event on the Stream implemented by Client and Component
 #[derive(Debug)]

tokio-xmpp/src/lib.rs 🔗

@@ -43,6 +43,6 @@ mod error;
 pub use crate::error::{AuthError, Error, ParseError, ProtocolError};
 
 // Re-exports
-pub use minidom::Element;
+pub use minidom;
 pub use xmpp_parsers as parsers;
-pub use xmpp_parsers::{BareJid, FullJid, Jid, JidParseError};
+pub use xmpp_parsers::jid;

tokio-xmpp/src/starttls/client.rs 🔗

@@ -1,6 +1,6 @@
 use std::str::FromStr;
 
-use xmpp_parsers::Jid;
+use xmpp_parsers::jid::Jid;
 
 use crate::{AsyncClient, AsyncConfig, Error, SimpleClient};
 

tokio-xmpp/src/starttls/mod.rs 🔗

@@ -18,12 +18,13 @@ use {
     tokio_native_tls::{TlsConnector, TlsStream},
 };
 
+use minidom::Element;
 use sasl::common::ChannelBinding;
 use tokio::{
     io::{AsyncRead, AsyncWrite},
     net::TcpStream,
 };
-use xmpp_parsers::{ns, Element, Jid};
+use xmpp_parsers::{jid::Jid, ns};
 
 use crate::{connect::ServerConnector, xmpp_codec::Packet, AsyncClient, SimpleClient};
 use crate::{connect::ServerConnectorError, xmpp_stream::XMPPStream};

tokio-xmpp/src/stream_features.rs 🔗

@@ -1,7 +1,8 @@
 //! Contains wrapper for `<stream:features/>`
 
 use crate::error::AuthError;
-use xmpp_parsers::{ns, Element};
+use minidom::Element;
+use xmpp_parsers::ns;
 
 /// Wraps `<stream:features/>`, usually the very first nonza of an
 /// XMPPStream.

tokio-xmpp/src/stream_start.rs 🔗

@@ -1,7 +1,8 @@
 use futures::{sink::SinkExt, stream::StreamExt};
+use minidom::Element;
 use tokio::io::{AsyncRead, AsyncWrite};
 use tokio_util::codec::Framed;
-use xmpp_parsers::{ns, Element, Jid};
+use xmpp_parsers::{jid::Jid, ns};
 
 use crate::xmpp_codec::{Packet, XmppCodec};
 use crate::xmpp_stream::XMPPStream;

tokio-xmpp/src/tcp/mod.rs 🔗

@@ -38,7 +38,7 @@ impl ServerConnector for TcpServerConnector {
     type Error = Error;
     async fn connect(
         &self,
-        jid: &xmpp_parsers::Jid,
+        jid: &xmpp_parsers::jid::Jid,
         ns: &str,
     ) -> Result<XMPPStream<Self::Stream>, Self::Error> {
         let stream = TcpStream::connect(&*self.0)

tokio-xmpp/src/xmpp_codec.rs 🔗

@@ -4,6 +4,7 @@ use crate::Error;
 use bytes::{BufMut, BytesMut};
 use log::debug;
 use minidom::tree_builder::TreeBuilder;
+use minidom::Element;
 use rxml::{Parse, RawParser};
 use std::collections::HashMap;
 use std::fmt::Write;
@@ -11,7 +12,6 @@ use std::io;
 #[cfg(feature = "syntax-highlighting")]
 use std::sync::OnceLock;
 use tokio_util::codec::{Decoder, Encoder};
-use xmpp_parsers::Element;
 
 #[cfg(feature = "syntax-highlighting")]
 static PS: OnceLock<syntect::parsing::SyntaxSet> = OnceLock::new();

tokio-xmpp/src/xmpp_stream.rs 🔗

@@ -2,12 +2,13 @@
 
 use futures::sink::Send;
 use futures::{sink::SinkExt, task::Poll, Sink, Stream};
+use minidom::Element;
 use rand::{thread_rng, Rng};
 use std::pin::Pin;
 use std::task::Context;
 use tokio::io::{AsyncRead, AsyncWrite};
 use tokio_util::codec::Framed;
-use xmpp_parsers::{Element, Jid};
+use xmpp_parsers::jid::Jid;
 
 use crate::stream_features::StreamFeatures;
 use crate::stream_start;