tokio-xmpp: rewrite for futures-0.3

This commit is contained in:
Astro 2020-03-05 01:25:24 +01:00
commit 23cb34e026
18 changed files with 801 additions and 1222 deletions

View file

@ -8,7 +8,7 @@ use trust_dns_proto::error::ProtoError;
use trust_dns_resolver::error::ResolveError;
use xmpp_parsers::sasl::DefinedCondition as SaslDefinedCondition;
use xmpp_parsers::Error as ParsersError;
use xmpp_parsers::{Error as ParsersError, JidParseError};
/// Top-level error type
#[derive(Debug)]
@ -20,6 +20,8 @@ pub enum Error {
/// DNS label conversion error, no details available from module
/// `idna`
Idna,
/// Error parsing Jabber-Id
JidParse(JidParseError),
/// Protocol-level error
Protocol(ProtocolError),
/// Authentication error
@ -38,6 +40,7 @@ impl fmt::Display for Error {
Error::Io(e) => write!(fmt, "IO error: {}", e),
Error::Connection(e) => write!(fmt, "connection error: {}", e),
Error::Idna => write!(fmt, "IDNA error"),
Error::JidParse(e) => write!(fmt, "jid parse error: {}", e),
Error::Protocol(e) => write!(fmt, "protocol error: {}", e),
Error::Auth(e) => write!(fmt, "authentication error: {}", e),
Error::Tls(e) => write!(fmt, "TLS error: {}", e),
@ -59,6 +62,12 @@ impl From<ConnecterError> for Error {
}
}
impl From<JidParseError> for Error {
fn from(e: JidParseError) -> Self {
Error::JidParse(e)
}
}
impl From<ProtocolError> for Error {
fn from(e: ProtocolError) -> Self {
Error::Protocol(e)