aboutsummaryrefslogtreecommitdiff
path: root/openssl/src/ssl/mod.rs
diff options
context:
space:
mode:
authorBenjamin Saunders <[email protected]>2018-03-10 22:30:54 -0800
committerBenjamin Saunders <[email protected]>2018-03-10 22:30:54 -0800
commite02dbde2f71a3406169c58e03a6cc8b90928945f (patch)
tree66ff1986399491797fa6d31fe4804deda69c279d /openssl/src/ssl/mod.rs
parentHigh-level API for OpenSSL 1.1.1 custom extension support (diff)
downloadrust-openssl-e02dbde2f71a3406169c58e03a6cc8b90928945f.tar.xz
rust-openssl-e02dbde2f71a3406169c58e03a6cc8b90928945f.zip
Generic custom extension add fn return type
Diffstat (limited to 'openssl/src/ssl/mod.rs')
-rw-r--r--openssl/src/ssl/mod.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/openssl/src/ssl/mod.rs b/openssl/src/ssl/mod.rs
index 402fa1ce..6a140c14 100644
--- a/openssl/src/ssl/mod.rs
+++ b/openssl/src/ssl/mod.rs
@@ -61,8 +61,6 @@ use ffi;
use foreign_types::{ForeignType, ForeignTypeRef, Opaque};
use libc::{c_char, c_int, c_long, c_uchar, c_uint, c_ulong, c_void};
use std::any::TypeId;
-#[cfg(all(feature = "v111", ossl111))]
-use std::borrow::Cow;
use std::cmp;
use std::collections::HashMap;
use std::ffi::{CStr, CString};
@@ -1511,10 +1509,12 @@ impl SslContextBuilder {
///
/// [`SSL_CTX_add_custom_ext`]: https://www.openssl.org/docs/manmaster/man3/SSL_CTX_add_custom_ext.html
#[cfg(all(feature = "v111", ossl111))]
- pub fn add_custom_ext<AddFn, ParseFn>(&mut self, ext_type: u16, context: ExtensionContext, add_cb: AddFn, parse_cb: ParseFn)
- -> Result<(), ErrorStack>
+ pub fn add_custom_ext<AddFn, ParseFn, T>(
+ &mut self, ext_type: u16, context: ExtensionContext, add_cb: AddFn, parse_cb: ParseFn
+ ) -> Result<(), ErrorStack>
where AddFn: Fn(&mut SslRef, ExtensionContext, Option<(usize, &X509Ref)>)
- -> Result<Option<Cow<'static, [u8]>>, SslAlert> + 'static + Sync + Send,
+ -> Result<Option<T>, SslAlert> + 'static + Sync + Send,
+ T: AsRef<[u8]> + 'static,
ParseFn: Fn(&mut SslRef, ExtensionContext, &[u8], Option<(usize, &X509Ref)>)
-> Result<(), SslAlert> + 'static + Sync + Send,
{
@@ -1534,8 +1534,8 @@ impl SslContextBuilder {
);
ffi::SSL_CTX_add_custom_ext(self.as_ptr(), ext_type as c_uint, context.bits(),
- Some(raw_custom_ext_add::<AddFn>),
- Some(raw_custom_ext_free),
+ Some(raw_custom_ext_add::<AddFn, T>),
+ Some(raw_custom_ext_free::<T>),
ptr::null_mut(),
Some(raw_custom_ext_parse::<ParseFn>),
ptr::null_mut())