Require Debug for NegotiateSsl

This forces the closure impl to go away but that seems not-important.
This commit is contained in:
Steven Fackler 2015-12-13 22:46:24 -08:00
parent 8fac512919
commit 2863b2ea0e
2 changed files with 3 additions and 25 deletions

View File

@ -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<StreamWrapper>,
/// Box<Error + Sync + Send>` 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<StreamWrapper>, Box<Error + Sync + Send>>;
}
impl<F> NegotiateSsl for F
where F: Fn(&str, Stream) -> Result<Box<StreamWrapper>, Box<Error + Sync + Send>>
{
fn negotiate_ssl(&self,
host: &str,
stream: Stream)
-> Result<Box<StreamWrapper>, Box<Error + Sync + Send>> {
(*self)(host, stream)
}
}

View File

@ -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,