Loading src/bn/mod.rs +1 −1 Original line number Diff line number Diff line Loading @@ -438,7 +438,7 @@ impl BigNum { } } impl fmt::Show for BigNum { impl fmt::Debug for BigNum { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{}", self.to_dec_str()) } Loading src/ssl/error.rs +7 −0 Original line number Diff line number Diff line Loading @@ -3,6 +3,7 @@ pub use self::OpensslError::*; use libc::c_ulong; use std::error; use std::fmt; use std::ffi::c_str_to_bytes; use std::io::IoError; Loading @@ -19,6 +20,12 @@ pub enum SslError { OpenSslErrors(Vec<OpensslError>) } impl fmt::Display for SslError { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { fmt.write_str(error::Error::description(self)) } } impl error::Error for SslError { fn description(&self) -> &str { match *self { Loading src/ssl/mod.rs +9 −9 Original line number Diff line number Diff line Loading @@ -35,7 +35,7 @@ fn init() { /// Determines the SSL method supported #[allow(non_camel_case_types)] #[derive(Copy, Clone, Show, Hash, PartialEq, Eq)] #[derive(Copy, Clone, Debug, Hash, PartialEq, Eq)] pub enum SslMethod { #[cfg(feature = "sslv2")] /// Only support the SSLv2 protocol, requires `feature="sslv2"` Loading Loading @@ -71,7 +71,7 @@ impl SslMethod { } /// Determines the type of certificate verification used #[derive(Copy, Clone, Show)] #[derive(Copy, Clone, Debug)] #[repr(i32)] pub enum SslVerifyMode { /// Verify that the server's certificate is trusted Loading Loading @@ -178,7 +178,7 @@ pub struct SslContext { } // TODO: add useful info here impl fmt::Show for SslContext { impl fmt::Debug for SslContext { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { write!(fmt, "SslContext") } Loading Loading @@ -301,7 +301,7 @@ pub struct Ssl { } // TODO: put useful information here impl fmt::Show for Ssl { impl fmt::Debug for Ssl { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { write!(fmt, "Ssl") } Loading Loading @@ -404,7 +404,7 @@ impl Ssl { } #[derive(FromPrimitive, Show)] #[derive(FromPrimitive, Debug)] #[repr(i32)] enum LibSslError { ErrorNone = ffi::SSL_ERROR_NONE, Loading @@ -426,7 +426,7 @@ pub struct SslStream<S> { buf: Vec<u8> } impl<S> fmt::Show for SslStream<S> where S: fmt::Show { impl<S> fmt::Debug for SslStream<S> where S: fmt::Debug { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { write!(fmt, "SslStream {{ stream: {:?}, ssl: {:?} }}", self.stream, self.ssl) } Loading Loading @@ -510,7 +510,7 @@ impl<S: Stream> SslStream<S> { LibSslError::ErrorWantRead => { try_ssl_stream!(self.flush()); let len = try_ssl_stream!(self.stream.read(self.buf.as_mut_slice())); self.ssl.get_rbio().write(self.buf.slice_to(len)); self.ssl.get_rbio().write(&self.buf[..len]); } LibSslError::ErrorWantWrite => { try_ssl_stream!(self.flush()) } LibSslError::ErrorZeroReturn => return Err(SslSessionClosed), Loading @@ -523,7 +523,7 @@ impl<S: Stream> SslStream<S> { fn write_through(&mut self) -> IoResult<()> { loop { match self.ssl.get_wbio().read(self.buf.as_mut_slice()) { Some(len) => try!(self.stream.write(self.buf.slice_to(len))), Some(len) => try!(self.stream.write(&self.buf[..len])), None => break }; } Loading Loading @@ -587,7 +587,7 @@ impl<S: Stream> Writer for SslStream<S> { } /// A utility type to help in cases where the use of SSL is decided at runtime. #[derive(Show)] #[derive(Debug)] pub enum MaybeSslStream<S> where S: Stream { /// A connection using SSL Ssl(SslStream<S>), Loading Loading
src/bn/mod.rs +1 −1 Original line number Diff line number Diff line Loading @@ -438,7 +438,7 @@ impl BigNum { } } impl fmt::Show for BigNum { impl fmt::Debug for BigNum { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{}", self.to_dec_str()) } Loading
src/ssl/error.rs +7 −0 Original line number Diff line number Diff line Loading @@ -3,6 +3,7 @@ pub use self::OpensslError::*; use libc::c_ulong; use std::error; use std::fmt; use std::ffi::c_str_to_bytes; use std::io::IoError; Loading @@ -19,6 +20,12 @@ pub enum SslError { OpenSslErrors(Vec<OpensslError>) } impl fmt::Display for SslError { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { fmt.write_str(error::Error::description(self)) } } impl error::Error for SslError { fn description(&self) -> &str { match *self { Loading
src/ssl/mod.rs +9 −9 Original line number Diff line number Diff line Loading @@ -35,7 +35,7 @@ fn init() { /// Determines the SSL method supported #[allow(non_camel_case_types)] #[derive(Copy, Clone, Show, Hash, PartialEq, Eq)] #[derive(Copy, Clone, Debug, Hash, PartialEq, Eq)] pub enum SslMethod { #[cfg(feature = "sslv2")] /// Only support the SSLv2 protocol, requires `feature="sslv2"` Loading Loading @@ -71,7 +71,7 @@ impl SslMethod { } /// Determines the type of certificate verification used #[derive(Copy, Clone, Show)] #[derive(Copy, Clone, Debug)] #[repr(i32)] pub enum SslVerifyMode { /// Verify that the server's certificate is trusted Loading Loading @@ -178,7 +178,7 @@ pub struct SslContext { } // TODO: add useful info here impl fmt::Show for SslContext { impl fmt::Debug for SslContext { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { write!(fmt, "SslContext") } Loading Loading @@ -301,7 +301,7 @@ pub struct Ssl { } // TODO: put useful information here impl fmt::Show for Ssl { impl fmt::Debug for Ssl { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { write!(fmt, "Ssl") } Loading Loading @@ -404,7 +404,7 @@ impl Ssl { } #[derive(FromPrimitive, Show)] #[derive(FromPrimitive, Debug)] #[repr(i32)] enum LibSslError { ErrorNone = ffi::SSL_ERROR_NONE, Loading @@ -426,7 +426,7 @@ pub struct SslStream<S> { buf: Vec<u8> } impl<S> fmt::Show for SslStream<S> where S: fmt::Show { impl<S> fmt::Debug for SslStream<S> where S: fmt::Debug { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { write!(fmt, "SslStream {{ stream: {:?}, ssl: {:?} }}", self.stream, self.ssl) } Loading Loading @@ -510,7 +510,7 @@ impl<S: Stream> SslStream<S> { LibSslError::ErrorWantRead => { try_ssl_stream!(self.flush()); let len = try_ssl_stream!(self.stream.read(self.buf.as_mut_slice())); self.ssl.get_rbio().write(self.buf.slice_to(len)); self.ssl.get_rbio().write(&self.buf[..len]); } LibSslError::ErrorWantWrite => { try_ssl_stream!(self.flush()) } LibSslError::ErrorZeroReturn => return Err(SslSessionClosed), Loading @@ -523,7 +523,7 @@ impl<S: Stream> SslStream<S> { fn write_through(&mut self) -> IoResult<()> { loop { match self.ssl.get_wbio().read(self.buf.as_mut_slice()) { Some(len) => try!(self.stream.write(self.buf.slice_to(len))), Some(len) => try!(self.stream.write(&self.buf[..len])), None => break }; } Loading Loading @@ -587,7 +587,7 @@ impl<S: Stream> Writer for SslStream<S> { } /// A utility type to help in cases where the use of SSL is decided at runtime. #[derive(Show)] #[derive(Debug)] pub enum MaybeSslStream<S> where S: Stream { /// A connection using SSL Ssl(SslStream<S>), Loading