Commit f24ab269 authored by Jonas Schievink's avatar Jonas Schievink
Browse files

FnMut -> FnOnce, update docs

parent 351bc569
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -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);

+3 −1
Original line number Diff line number Diff line
@@ -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);

+1 −1
Original line number Diff line number Diff line
@@ -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) };