From 1e65b20eadd39994f03e3ecec28c09e5bec918d5 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Tue, 2 May 2017 17:21:03 +0100 Subject: [PATCH] implement From for Error --- src/error.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/error.rs b/src/error.rs index 49a1ce3e..036fbe90 100644 --- a/src/error.rs +++ b/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), XmppSaslError(SaslError), + FormatError(FormatError), StreamError, EndOfDocument, } @@ -73,3 +76,9 @@ impl From for Error { Error::Base64Error(err) } } + +impl From for Error { + fn from(err: FormatError) -> Error { + Error::FormatError(err) + } +}