aboutsummaryrefslogtreecommitdiff
path: root/openssl/src
diff options
context:
space:
mode:
authorJonas Schievink <[email protected]>2016-06-26 19:44:53 +0200
committerJonas Schievink <[email protected]>2016-06-26 19:44:53 +0200
commitf24ab2693636f16ce71a171a4d4d63bd0f5bbea0 (patch)
treecfdc4e6437337104c8a2e5cb6d39621517597629 /openssl/src
parentPut the test behind the catch_unwind feature (diff)
downloadrust-openssl-f24ab2693636f16ce71a171a4d4d63bd0f5bbea0.tar.xz
rust-openssl-f24ab2693636f16ce71a171a4d4d63bd0f5bbea0.zip
FnMut -> FnOnce, update docs
Diffstat (limited to 'openssl/src')
-rw-r--r--openssl/src/crypto/pkey.rs4
-rw-r--r--openssl/src/crypto/rsa.rs4
-rw-r--r--openssl/src/crypto/util.rs2
3 files changed, 7 insertions, 3 deletions
diff --git a/openssl/src/crypto/pkey.rs b/openssl/src/crypto/pkey.rs
index bbb8427d..15744047 100644
--- a/openssl/src/crypto/pkey.rs
+++ b/openssl/src/crypto/pkey.rs
@@ -103,9 +103,11 @@ impl PKey {
///
/// The callback will be passed the password buffer and should return the number of characters
/// placed into the buffer.
+ ///
+ /// Requires the `catch_unwind` feature.
#[cfg(feature = "catch_unwind")]
pub fn private_key_from_pem_cb<R, F>(reader: &mut R, pass_cb: F) -> Result<PKey, SslError>
- where R: Read, F: FnMut(&mut [c_char]) -> usize
+ where R: Read, F: FnOnce(&mut [c_char]) -> usize
{
let mut cb = CallbackState::new(pass_cb);
diff --git a/openssl/src/crypto/rsa.rs b/openssl/src/crypto/rsa.rs
index 9a04bf7f..3b420fbc 100644
--- a/openssl/src/crypto/rsa.rs
+++ b/openssl/src/crypto/rsa.rs
@@ -82,9 +82,11 @@ impl RSA {
}
/// Reads an RSA private key from PEM formatted data and supplies a password callback.
+ ///
+ /// Requires the `catch_unwind` feature.
#[cfg(feature = "catch_unwind")]
pub fn private_key_from_pem_cb<R, F>(reader: &mut R, pass_cb: F) -> Result<RSA, SslError>
- where R: Read, F: FnMut(&mut [c_char]) -> usize
+ where R: Read, F: FnOnce(&mut [c_char]) -> usize
{
let mut cb = CallbackState::new(pass_cb);
diff --git a/openssl/src/crypto/util.rs b/openssl/src/crypto/util.rs
index 85df86b7..be72aa59 100644
--- a/openssl/src/crypto/util.rs
+++ b/openssl/src/crypto/util.rs
@@ -41,7 +41,7 @@ pub extern "C" fn invoke_passwd_cb<F>(buf: *mut c_char,
_rwflag: c_int,
cb_state: *mut c_void)
-> c_int
- where F: FnMut(&mut [i8]) -> usize {
+ where F: FnOnce(&mut [i8]) -> usize {
let result = panic::catch_unwind(|| {
// build a `i8` slice to pass to the user callback
let pass_slice = unsafe { slice::from_raw_parts_mut(buf, size as usize) };