From 40024d2dadba9e70edb2f3448204565ce3f68ab7 Mon Sep 17 00:00:00 2001 From: cel 🌸 Date: Sat, 23 Nov 2024 22:39:44 +0000 Subject: switch to using peanuts for xml --- src/error.rs | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) (limited to 'src/error.rs') 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 for JabberError { +impl From for Error { fn from(e: rsasl::prelude::SASLError) -> Self { Self::SASL(SASLError::SASL(e)) } } -impl From for JabberError { +impl From for Error { fn from(e: MechanismNameError) -> Self { Self::SASL(SASLError::MechanismName(e)) } } -impl From for JabberError { +impl From for Error { fn from(e: SASLError) -> Self { Self::SASL(e) } } -impl From for JabberError { +impl From for Error { fn from(_e: Utf8Error) -> Self { Self::Utf8Decode } } -impl From for JabberError { - fn from(e: quick_xml::Error) -> Self { +impl From for Error { + fn from(e: peanuts::Error) -> Self { Self::XML(e) } } -impl From for JabberError { - fn from(e: AttrError) -> Self { - Self::XML(e.into()) - } -} - -impl From for JabberError { +impl From for Error { fn from(e: ParseError) -> Self { Self::JID(e) } -- cgit