diff options
author | 2024-11-23 22:39:44 +0000 | |
---|---|---|
committer | 2024-11-23 22:39:44 +0000 | |
commit | 40024d2dadba9e70edb2f3448204565ce3f68ab7 (patch) | |
tree | 3f08b61debf936c513f300c845d8a1cb29edd7c8 /src/error.rs | |
parent | 9f2546f6dadd916b0e7fc5be51e92d682ef2487b (diff) | |
download | luz-40024d2dadba9e70edb2f3448204565ce3f68ab7.tar.gz luz-40024d2dadba9e70edb2f3448204565ce3f68ab7.tar.bz2 luz-40024d2dadba9e70edb2f3448204565ce3f68ab7.zip |
switch to using peanuts for xml
Diffstat (limited to 'src/error.rs')
-rw-r--r-- | src/error.rs | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/src/error.rs b/src/error.rs index b12914c..c7c867c 100644 --- a/src/error.rs +++ b/src/error.rs @@ -1,12 +1,11 @@ use std::str::Utf8Error; -use quick_xml::events::attributes::AttrError; use rsasl::mechname::MechanismNameError; use crate::jid::ParseError; #[derive(Debug)] -pub enum JabberError { +pub enum Error { Connection, BadStream, StartTlsUnavailable, @@ -23,7 +22,7 @@ pub enum JabberError { UnexpectedEnd, UnexpectedElement, UnexpectedText, - XML(quick_xml::Error), + XML(peanuts::Error), SASL(SASLError), JID(ParseError), } @@ -36,43 +35,37 @@ pub enum SASLError { NoSuccess, } -impl From<rsasl::prelude::SASLError> for JabberError { +impl From<rsasl::prelude::SASLError> for Error { fn from(e: rsasl::prelude::SASLError) -> Self { Self::SASL(SASLError::SASL(e)) } } -impl From<MechanismNameError> for JabberError { +impl From<MechanismNameError> for Error { fn from(e: MechanismNameError) -> Self { Self::SASL(SASLError::MechanismName(e)) } } -impl From<SASLError> for JabberError { +impl From<SASLError> for Error { fn from(e: SASLError) -> Self { Self::SASL(e) } } -impl From<Utf8Error> for JabberError { +impl From<Utf8Error> for Error { fn from(_e: Utf8Error) -> Self { Self::Utf8Decode } } -impl From<quick_xml::Error> for JabberError { - fn from(e: quick_xml::Error) -> Self { +impl From<peanuts::Error> for Error { + fn from(e: peanuts::Error) -> Self { Self::XML(e) } } -impl From<AttrError> for JabberError { - fn from(e: AttrError) -> Self { - Self::XML(e.into()) - } -} - -impl From<ParseError> for JabberError { +impl From<ParseError> for Error { fn from(e: ParseError) -> Self { Self::JID(e) } |