From 5136023a44cd15aaa0fe0b50d85720d936d256c7 Mon Sep 17 00:00:00 2001 From: "Neal H. Walfield" Date: Mon, 24 Dec 2018 15:01:34 +0100 Subject: openpgp: Change set_secret to return the old secret. --- openpgp/src/packet/key.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'openpgp') 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) { - self.secret = secret; + /// + /// Returns the old value. + pub fn set_secret(&mut self, secret: Option) + -> Option + { + mem::replace(&mut self.secret, secret) } /// Convert the `Key` struct to a `Packet`. -- cgit v1.2.3