diff options
Diffstat (limited to 'openpgp/src/packet_pile.rs')
-rw-r--r-- | openpgp/src/packet_pile.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/openpgp/src/packet_pile.rs b/openpgp/src/packet_pile.rs index a3593edd..3539623d 100644 --- a/openpgp/src/packet_pile.rs +++ b/openpgp/src/packet_pile.rs @@ -12,6 +12,7 @@ use buffered_reader::BufferedReader; use crate::Result; use crate::Error; use crate::Packet; +use crate::cert::Cert; use crate::packet::{self, Container}; use crate::parse::PacketParserResult; use crate::parse::PacketParserBuilder; @@ -323,6 +324,13 @@ impl PacketPile { } } +impl From<Cert> for PacketPile { + /// Converts the `Cert` into a `PacketPile`. + fn from(cert: Cert) -> PacketPile { + PacketPile::from(cert.into_packets().collect::<Vec<Packet>>()) + } +} + impl<'a> TryFrom<PacketParserResult<'a>> for PacketPile { type Error = anyhow::Error; |