summaryrefslogtreecommitdiffstats
path: root/openpgp/src/packet/unknown.rs
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2019-12-19 14:15:21 +0100
committerJustus Winter <justus@sequoia-pgp.org>2019-12-20 18:04:56 +0100
commit046cbc7837cfae8505cb77cdc0352eeaac023a85 (patch)
treeacd00a0e9043b83648a749a32602b870e2bacbf4 /openpgp/src/packet/unknown.rs
parent103379888e9d0ccc701a24f2adb539bc9095f10b (diff)
openpgp: Move fields from Common to Container.
Diffstat (limited to 'openpgp/src/packet/unknown.rs')
-rw-r--r--openpgp/src/packet/unknown.rs10
1 files changed, 3 insertions, 7 deletions
diff --git a/openpgp/src/packet/unknown.rs b/openpgp/src/packet/unknown.rs
index 07cd5e0e..d9bfbfd0 100644
--- a/openpgp/src/packet/unknown.rs
+++ b/openpgp/src/packet/unknown.rs
@@ -41,10 +41,6 @@ impl PartialOrd for Unknown
impl Ord for Unknown
{
fn cmp(&self, other: &Unknown) -> Ordering {
- // An unknown packet cannot have children.
- assert!(self.common.children.is_none());
- assert!(other.common.children.is_none());
-
match self.tag.cmp(&other.tag) {
Ordering::Equal => self.common.body().cmp(&other.common.body()),
o => o,
@@ -110,7 +106,7 @@ impl Unknown {
/// information, and not encoded using something like OpenPGP's
/// partial body encoding.
pub fn body(&self) -> Option<&[u8]> {
- self.common.body.as_ref().map(|b| b.as_slice())
+ self.common.body()
}
/// Sets the packet's contents.
@@ -118,8 +114,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>) -> Option<Vec<u8>> {
- ::std::mem::replace(&mut self.common.body, Some(data))
+ pub fn set_body(&mut self, data: Vec<u8>) -> Vec<u8> {
+ self.common.set_body(data)
}
}