use std::io; use std::net::TcpStream; use openssl::ssl::HandshakeError; use openssl::error::ErrorStack; use xml::reader::Error as XmlError; use xml::writer::Error as EmitterError; #[derive(Debug)] pub enum Error { XmlError(XmlError), EmitterError(EmitterError), IoError(io::Error), HandshakeError(HandshakeError), OpenSslErrorStack(ErrorStack), StreamError, } impl From for Error { fn from(err: XmlError) -> Error { Error::XmlError(err) } } impl From for Error { fn from(err: EmitterError) -> Error { Error::EmitterError(err) } } impl From for Error { fn from(err: io::Error) -> Error { Error::IoError(err) } } impl From> for Error { fn from(err: HandshakeError) -> Error { Error::HandshakeError(err) } } impl From for Error { fn from(err: ErrorStack) -> Error { Error::OpenSslErrorStack(err) } }