diff options
author | Justus Winter <justus@sequoia-pgp.org> | 2023-10-10 18:57:30 +0200 |
---|---|---|
committer | Justus Winter <justus@sequoia-pgp.org> | 2023-10-11 10:20:31 +0200 |
commit | c1a3ab926e4bd4a73b1becdf08b8f4ecb26fc628 (patch) | |
tree | 3219b2c5f8df7203ab87bfb91633013be218659c /net/src/wkd.rs | |
parent | 3ec528dd304f65b7d7c0e537920c5b93a4d6b9c0 (diff) |
openpgp: Add non-allocating accessors for parsed User ID components.
- Now that we use OnceCell for the cache, we can hand out references
to the cached data. This closes the gap between UserID and
ConventionallyParsedUserID, hence I think this addresses the
concern in #377.
- Deprecate the allocating variants.
- Fixes #377.
Diffstat (limited to 'net/src/wkd.rs')
-rw-r--r-- | net/src/wkd.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/net/src/wkd.rs b/net/src/wkd.rs index ca918733..c1bb0852 100644 --- a/net/src/wkd.rs +++ b/net/src/wkd.rs @@ -167,7 +167,7 @@ fn parse_body<S: AsRef<str>>(body: &[u8], email_address: S) // method to maintain .filter(|cert| {cert.userids() .any(|uidb| - if let Ok(Some(a)) = uidb.userid().email() { + if let Ok(Some(a)) = uidb.userid().email2() { a == email_address } else { false }) }).cloned().collect(); @@ -244,7 +244,7 @@ pub async fn get<S: AsRef<str>>(c: &reqwest::Client, email_address: S) fn get_cert_domains<'a>(domain: &'a str, cert: &ValidCert<'a>) -> impl Iterator<Item = Url> + 'a { cert.userids().filter_map(move |uidb| { - uidb.userid().email().unwrap_or(None).and_then(|addr| { + uidb.userid().email2().unwrap_or(None).and_then(|addr| { if EmailAddress::from(&addr).ok().map(|e| e.domain == domain) .unwrap_or(false) { |