diff options
author | Neal H. Walfield <neal@pep.foundation> | 2018-12-24 15:01:34 +0100 |
---|---|---|
committer | Neal H. Walfield <neal@pep.foundation> | 2018-12-24 16:31:13 +0100 |
commit | 5136023a44cd15aaa0fe0b50d85720d936d256c7 (patch) | |
tree | d689ee317fbfdfe0d8c9fb9fc41c2c07852c0ab0 /openpgp | |
parent | b7d298d544afaca714bf07aca72c125c16192c72 (diff) |
openpgp: Change set_secret to return the old secret.
Diffstat (limited to 'openpgp')
-rw-r--r-- | openpgp/src/packet/key.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/openpgp/src/packet/key.rs b/openpgp/src/packet/key.rs index 98b064d0..c5a9e663 100644 --- a/openpgp/src/packet/key.rs +++ b/openpgp/src/packet/key.rs @@ -226,8 +226,12 @@ impl Key { } /// Sets the key packet's SecretKey. - pub fn set_secret(&mut self, secret: Option<SecretKey>) { - self.secret = secret; + /// + /// Returns the old value. + pub fn set_secret(&mut self, secret: Option<SecretKey>) + -> Option<SecretKey> + { + mem::replace(&mut self.secret, secret) } /// Convert the `Key` struct to a `Packet`. |