diff options
author | Justus Winter <justus@sequoia-pgp.org> | 2019-02-06 17:51:51 +0100 |
---|---|---|
committer | Justus Winter <justus@sequoia-pgp.org> | 2019-02-06 17:51:51 +0100 |
commit | 020ee5d5f420ec47d09f831cb0d7dc5198d3da52 (patch) | |
tree | f7e296dcbf36e425d357e4bbb1aba147f083589e /openpgp/src/packet/unknown.rs | |
parent | 7e7071cdd64ad387ac82af259a3a44c5488b2392 (diff) |
openpgp: Return previous value in setters.
- See #147.
Diffstat (limited to 'openpgp/src/packet/unknown.rs')
-rw-r--r-- | openpgp/src/packet/unknown.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/openpgp/src/packet/unknown.rs b/openpgp/src/packet/unknown.rs index 77c7ff3c..86dd937a 100644 --- a/openpgp/src/packet/unknown.rs +++ b/openpgp/src/packet/unknown.rs @@ -63,8 +63,8 @@ impl Unknown { } /// Sets the unknown packet's tag. - pub fn set_tag(&mut self, tag: Tag) { - self.tag = tag; + pub fn set_tag(&mut self, tag: Tag) -> Tag { + ::std::mem::replace(&mut self.tag, tag) } /// Gets the unknown packet's error. @@ -95,8 +95,8 @@ impl Unknown { /// This is the raw packet content not include the CTB and length /// information, and not encoded using something like OpenPGP's /// partial body encoding. - pub fn set_body(&mut self, data: Vec<u8>) { - self.common.body = Some(data); + pub fn set_body(&mut self, data: Vec<u8>) -> Option<Vec<u8>> { + ::std::mem::replace(&mut self.common.body, Some(data)) } } |