diff --git a/src/io/mod.rs b/src/io/mod.rs index bd2313f8..2e53af42 100644 --- a/src/io/mod.rs +++ b/src/io/mod.rs @@ -3,6 +3,7 @@ pub use priv_io::Stream; use std::error::Error; use std::io::prelude::*; +use std::fmt; #[cfg(feature = "openssl")] mod openssl; @@ -25,10 +26,7 @@ pub trait StreamWrapper: Read+Write+Send { /// /// If the `security-framework` Cargo feature is enabled, this trait will be /// implemented for `security_framework::secure_transport::ClientBuilder`. -/// -/// It is also implemented for `Fn(&str, Stream) -> Result, -/// Box` closures. -pub trait NegotiateSsl { +pub trait NegotiateSsl: fmt::Debug { /// Negotiates an SSL session, returning a wrapper around the provided /// stream. /// @@ -39,14 +37,3 @@ pub trait NegotiateSsl { stream: Stream) -> Result, Box>; } - -impl NegotiateSsl for F - where F: Fn(&str, Stream) -> Result, Box> -{ - fn negotiate_ssl(&self, - host: &str, - stream: Stream) - -> Result, Box> { - (*self)(host, stream) - } -} diff --git a/src/lib.rs b/src/lib.rs index f777408f..7374bff8 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -352,6 +352,7 @@ impl IsolationLevel { } /// Specifies the SSL support requested for a new connection. +#[derive(Debug)] pub enum SslMode<'a> { /// The connection will not use SSL. None, @@ -361,16 +362,6 @@ pub enum SslMode<'a> { Require(&'a NegotiateSsl), } -impl<'a> fmt::Debug for SslMode<'a> { - fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { - match *self { - SslMode::None => fmt.write_str("None"), - SslMode::Prefer(..) => fmt.write_str("Prefer"), - SslMode::Require(..) => fmt.write_str("Require"), - } - } -} - #[derive(Clone)] struct CachedStatement { name: String,