From 046cbc7837cfae8505cb77cdc0352eeaac023a85 Mon Sep 17 00:00:00 2001 From: Justus Winter Date: Thu, 19 Dec 2019 14:15:21 +0100 Subject: openpgp: Move fields from Common to Container. --- openpgp/src/packet/unknown.rs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'openpgp/src/packet/unknown.rs') 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) -> Option> { - ::std::mem::replace(&mut self.common.body, Some(data)) + pub fn set_body(&mut self, data: Vec) -> Vec { + self.common.set_body(data) } } -- cgit v1.2.3