Clean up generics a bit

This commit is contained in:
Steven Fackler 2016-10-30 11:05:29 -07:00
parent a8d328d0b4
commit eb735f519a
1 changed files with 15 additions and 15 deletions

View File

@ -105,25 +105,25 @@ pub struct ServerConnectorBuilder(SslContextBuilder);
impl ServerConnectorBuilder { impl ServerConnectorBuilder {
/// Creates a new builder for server-side TLS connections. /// Creates a new builder for server-side TLS connections.
/// ///
/// The default configuration is based off of the intermediate profile of Mozilla's SSL /// The default configuration is based off of the intermediate profile of Mozilla's server side
/// Configuration Generator, and is subject to change. /// TLS configuration recommendations, and is subject to change.
pub fn tls<I, T>(private_key: &PKeyRef, pub fn tls<I>(private_key: &PKeyRef,
certificate: &X509Ref, certificate: &X509Ref,
chain: I) chain: I)
-> Result<ServerConnectorBuilder, ErrorStack> -> Result<ServerConnectorBuilder, ErrorStack>
where I: IntoIterator<Item = T>, where I: IntoIterator,
T: AsRef<X509Ref> I::Item: AsRef<X509Ref>
{ {
ServerConnectorBuilder::new(SslMethod::tls(), private_key, certificate, chain) ServerConnectorBuilder::new(SslMethod::tls(), private_key, certificate, chain)
} }
fn new<I, T>(method: SslMethod, fn new<I>(method: SslMethod,
private_key: &PKeyRef, private_key: &PKeyRef,
certificate: &X509Ref, certificate: &X509Ref,
chain: I) chain: I)
-> Result<ServerConnectorBuilder, ErrorStack> -> Result<ServerConnectorBuilder, ErrorStack>
where I: IntoIterator<Item = T>, where I: IntoIterator,
T: AsRef<X509Ref> I::Item: AsRef<X509Ref>
{ {
let mut ctx = try!(ctx(method)); let mut ctx = try!(ctx(method));
ctx.set_options(ssl::SSL_OP_SINGLE_DH_USE | ssl::SSL_OP_CIPHER_SERVER_PREFERENCE); ctx.set_options(ssl::SSL_OP_SINGLE_DH_USE | ssl::SSL_OP_CIPHER_SERVER_PREFERENCE);