summaryrefslogtreecommitdiffstats
path: root/openpgp/src/packet_pile.rs
diff options
context:
space:
mode:
authorNeal H. Walfield <neal@pep.foundation>2020-04-03 20:44:19 +0200
committerNeal H. Walfield <neal@pep.foundation>2020-04-03 20:45:02 +0200
commite7f13bab21d0af8fee3e532e25c3dd59fce3b6d3 (patch)
tree576a9345667233d9ae7631802981e51da41c3037 /openpgp/src/packet_pile.rs
parente2cb547a2d4792c7a0a19fcbb9adf5342ddc7d5e (diff)
openpgp: Return impl Iterator instead of a concrete type
Diffstat (limited to 'openpgp/src/packet_pile.rs')
-rw-r--r--openpgp/src/packet_pile.rs9
1 files changed, 6 insertions, 3 deletions
diff --git a/openpgp/src/packet_pile.rs b/openpgp/src/packet_pile.rs
index 3539623d..bd640aa5 100644
--- a/openpgp/src/packet_pile.rs
+++ b/openpgp/src/packet_pile.rs
@@ -1,6 +1,5 @@
use std::convert::TryFrom;
use std::fmt;
-use std::slice;
use std::vec;
use std::io;
use std::path::Path;
@@ -306,12 +305,16 @@ impl PacketPile {
}
/// Returns an iterator over the top-level packets.
- pub fn children<'a>(&'a self) -> slice::Iter<'a, Packet> {
+ pub fn children(&self)
+ -> impl Iterator<Item=&Packet> + ExactSizeIterator
+ {
self.top_level.children().expect("toplevel is a container")
}
/// Returns an `IntoIter` over the top-level packets.
- pub fn into_children(self) -> vec::IntoIter<Packet> {
+ pub fn into_children(self)
+ -> impl Iterator<Item=Packet> + ExactSizeIterator
+ {
self.top_level.into_children().expect("toplevel is a container")
}