summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2018-06-29 13:47:00 +0200
committerJustus Winter <justus@sequoia-pgp.org>2018-06-29 15:18:11 +0200
commit30bef91a9cbf5f9a7f474da921b92ac9d8d089c2 (patch)
treeeb954ee296216fa39d16bd5d5472878d54331b86
parent1a1a6feb9f2ed2e0c1986a415a5761b6dc6025c6 (diff)
openpgp: Make SubpacketArea::lookup public.
- Also make it return Subpacket instead of SubpacketRaw.
-rw-r--r--openpgp/src/subpacket.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/openpgp/src/subpacket.rs b/openpgp/src/subpacket.rs
index 3f494bf4..ab31ee35 100644
--- a/openpgp/src/subpacket.rs
+++ b/openpgp/src/subpacket.rs
@@ -421,8 +421,8 @@ impl SubpacketArea {
*self.parsed.borrow_mut() = None;
}
- // Returns the last subpacket, if any, with the specified tag.
- fn lookup(&self, tag: SubpacketTag) -> Option<SubpacketRaw> {
+ /// Returns the last subpacket, if any, with the specified tag.
+ pub fn lookup(&self, tag: SubpacketTag) -> Option<Subpacket> {
self.cache_init();
match self.parsed.borrow().as_ref().unwrap().get(&tag) {
@@ -1283,7 +1283,7 @@ impl Signature {
/// Returns the *last* instance of the specified subpacket.
fn subpacket<'a>(&'a self, tag: SubpacketTag) -> Option<Subpacket<'a>> {
if let Some(sb) = self.hashed_area.lookup(tag) {
- return Some(sb.into());
+ return Some(sb);
}
// There are a couple of subpackets that we are willing to
@@ -1294,7 +1294,7 @@ impl Signature {
return None;
}
- self.unhashed_area.lookup(tag).map(|sb| sb.into())
+ self.unhashed_area.lookup(tag)
}
/// Returns all instances of the specified subpacket.