summaryrefslogtreecommitdiffstats
path: root/openpgp/src/packet_pile.rs
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2024-01-15 18:35:00 +0100
committerJustus Winter <justus@sequoia-pgp.org>2024-01-22 13:48:32 +0100
commitb838d4b1bfc4b432e908741c94b336df19d201ad (patch)
treeaf9d9a77b046f8de9d9887aeae99a683b2c16565 /openpgp/src/packet_pile.rs
parent96d829d681ea1b860bf4b16439082929f4636147 (diff)
openpgp: Add Parse::from_buffered_reader.
- Add a buffered-reader-based function to trait Parse. This allows us to manipulate the buffered reader stack before and after parsing, e.g. to parse several armored objects in one stream. The CertParser also does this, but uses internal interfaces for that.
Diffstat (limited to 'openpgp/src/packet_pile.rs')
-rw-r--r--openpgp/src/packet_pile.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/openpgp/src/packet_pile.rs b/openpgp/src/packet_pile.rs
index f62eb6f6..1678c523 100644
--- a/openpgp/src/packet_pile.rs
+++ b/openpgp/src/packet_pile.rs
@@ -120,6 +120,17 @@ impl fmt::Debug for PacketPile {
}
impl<'a> Parse<'a, PacketPile> for PacketPile {
+ /// Deserializes the OpenPGP message stored in the file named by
+ /// `path`.
+ ///
+ /// See `from_reader` for more details and caveats.
+ fn from_buffered_reader<R>(reader: R) -> Result<PacketPile>
+ where
+ R: BufferedReader<Cookie> + 'a,
+ {
+ PacketPile::from_cookie_reader(reader.into_boxed())
+ }
+
/// Deserializes the OpenPGP message stored in a `std::io::Read`
/// object.
///