diff options
-rw-r--r-- | openpgp/examples/statistics.rs | 2 | ||||
-rw-r--r-- | openpgp/src/parse/parse.rs | 7 | ||||
-rw-r--r-- | tool/src/commands/decrypt.rs | 2 | ||||
-rw-r--r-- | tool/src/commands/dump.rs | 2 |
4 files changed, 9 insertions, 4 deletions
diff --git a/openpgp/examples/statistics.rs b/openpgp/examples/statistics.rs index ff2a9cf9..ae650aed 100644 --- a/openpgp/examples/statistics.rs +++ b/openpgp/examples/statistics.rs @@ -46,7 +46,7 @@ fn main() { // Iterate over all packets. while let PacketParserResult::Some(pp) = ppr { // While the packet is in the parser, get some data for later. - let size = match pp.header.length { + let size = match pp.header().length { BodyLength::Full(n) => Some(n), _ => None, }; diff --git a/openpgp/src/parse/parse.rs b/openpgp/src/parse/parse.rs index 60b95ec3..b1e4abf9 100644 --- a/openpgp/src/parse/parse.rs +++ b/openpgp/src/parse/parse.rs @@ -2133,7 +2133,7 @@ impl PacketParserState { /// # } pub struct PacketParser<'a> { /// The current packet's header. - pub header: Header, + header: Header, /// The packet that is being parsed. pub packet: Packet, @@ -3033,6 +3033,11 @@ impl <'a> PacketParser<'a> { Ok(&mut self.packet) } + /// Returns a reference to the current packet's header. + pub fn header(&self) -> &Header { + &self.header + } + /// Returns a reference to the map (if any is written). pub fn map(&self) -> Option<&map::Map> { self.map.as_ref() diff --git a/tool/src/commands/decrypt.rs b/tool/src/commands/decrypt.rs index d6f9a468..2998c616 100644 --- a/tool/src/commands/decrypt.rs +++ b/tool/src/commands/decrypt.rs @@ -113,7 +113,7 @@ impl<'a> DecryptionHelper for Helper<'a> { if let Some(dumper) = self.dumper.as_mut() { dumper.packet(&mut io::stderr(), pp.recursion_depth() as usize, - pp.header.clone(), pp.packet.clone(), + pp.header().clone(), pp.packet.clone(), pp.map().map(|m| m.clone()), None)?; } Ok(()) diff --git a/tool/src/commands/dump.rs b/tool/src/commands/dump.rs index 5f7ec627..02980b59 100644 --- a/tool/src/commands/dump.rs +++ b/tool/src/commands/dump.rs @@ -32,7 +32,7 @@ pub fn dump(input: &mut io::Read, output: &mut io::Write, mpis: bool, hex: bool) _ => None, }; - let header = pp.header.clone(); + let header = pp.header().clone(); let map = pp.take_map(); let (packet, ppr_) = pp.recurse()?; |