Require Debug for NegotiateSsl
This forces the closure impl to go away but that seems not-important.
This commit is contained in:
parent
8fac512919
commit
2863b2ea0e
@ -3,6 +3,7 @@ pub use priv_io::Stream;
|
|||||||
|
|
||||||
use std::error::Error;
|
use std::error::Error;
|
||||||
use std::io::prelude::*;
|
use std::io::prelude::*;
|
||||||
|
use std::fmt;
|
||||||
|
|
||||||
#[cfg(feature = "openssl")]
|
#[cfg(feature = "openssl")]
|
||||||
mod 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
|
/// If the `security-framework` Cargo feature is enabled, this trait will be
|
||||||
/// implemented for `security_framework::secure_transport::ClientBuilder`.
|
/// implemented for `security_framework::secure_transport::ClientBuilder`.
|
||||||
///
|
pub trait NegotiateSsl: fmt::Debug {
|
||||||
/// It is also implemented for `Fn(&str, Stream) -> Result<Box<StreamWrapper>,
|
|
||||||
/// Box<Error + Sync + Send>` closures.
|
|
||||||
pub trait NegotiateSsl {
|
|
||||||
/// Negotiates an SSL session, returning a wrapper around the provided
|
/// Negotiates an SSL session, returning a wrapper around the provided
|
||||||
/// stream.
|
/// stream.
|
||||||
///
|
///
|
||||||
@ -39,14 +37,3 @@ pub trait NegotiateSsl {
|
|||||||
stream: Stream)
|
stream: Stream)
|
||||||
-> Result<Box<StreamWrapper>, Box<Error + Sync + Send>>;
|
-> 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)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
11
src/lib.rs
11
src/lib.rs
@ -352,6 +352,7 @@ impl IsolationLevel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Specifies the SSL support requested for a new connection.
|
/// Specifies the SSL support requested for a new connection.
|
||||||
|
#[derive(Debug)]
|
||||||
pub enum SslMode<'a> {
|
pub enum SslMode<'a> {
|
||||||
/// The connection will not use SSL.
|
/// The connection will not use SSL.
|
||||||
None,
|
None,
|
||||||
@ -361,16 +362,6 @@ pub enum SslMode<'a> {
|
|||||||
Require(&'a NegotiateSsl),
|
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)]
|
#[derive(Clone)]
|
||||||
struct CachedStatement {
|
struct CachedStatement {
|
||||||
name: String,
|
name: String,
|
||||||
|
Loading…
Reference in New Issue
Block a user