diff options
author | Justus Winter <justus@sequoia-pgp.org> | 2018-12-07 16:47:45 +0100 |
---|---|---|
committer | Justus Winter <justus@sequoia-pgp.org> | 2018-12-07 16:48:26 +0100 |
commit | eecbf652b083f09d5fb3912cb47ebff954424e5f (patch) | |
tree | 61fff152c577ccdd1978a55619c1c56c134061a7 /openpgp | |
parent | 58286b06295c95f77b1bb2cb28dc247238080a7a (diff) |
openpgp: Make PacketParser's header field private.
Diffstat (limited to 'openpgp')
-rw-r--r-- | openpgp/examples/statistics.rs | 2 | ||||
-rw-r--r-- | openpgp/src/parse/parse.rs | 7 |
2 files changed, 7 insertions, 2 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() |