implement From<FormatError> for Error

Emmanuel Gil Peyrot created

Change summary

src/error.rs | 9 +++++++++
1 file changed, 9 insertions(+)

Detailed changes

src/error.rs 🔗

@@ -1,5 +1,7 @@
 //! Provides an `Error` for use in this crate.
 
+use std::fmt::Error as FormatError;
+
 use std::io;
 
 use std::net::TcpStream;
@@ -28,6 +30,7 @@ pub enum Error {
     Base64Error(Base64Error),
     SaslError(Option<String>),
     XmppSaslError(SaslError),
+    FormatError(FormatError),
     StreamError,
     EndOfDocument,
 }
@@ -73,3 +76,9 @@ impl From<Base64Error> for Error {
         Error::Base64Error(err)
     }
 }
+
+impl From<FormatError> for Error {
+    fn from(err: FormatError) -> Error {
+        Error::FormatError(err)
+    }
+}