diff options
author | Neal H. Walfield <neal@sequoia-pgp.org> | 2024-01-24 15:44:18 +0100 |
---|---|---|
committer | Neal H. Walfield <neal@sequoia-pgp.org> | 2024-01-24 16:01:48 +0100 |
commit | a55cd9025faf9fea54b63d168a5bec555c95ba7f (patch) | |
tree | 556bc48933aeff7f6b5b09b8b24e3c83af39b608 /openpgp | |
parent | 5d2f1f8eb72c484144de702dcd5344115ce91b3d (diff) |
openpgp: Improve example.
- Simplify initialization.
- Use `KeyHandle::aliases` to compare two `KeyHandle`s.
Diffstat (limited to 'openpgp')
-rw-r--r-- | openpgp/src/keyhandle.rs | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/openpgp/src/keyhandle.rs b/openpgp/src/keyhandle.rs index 5e6dc3d8..7ceb4466 100644 --- a/openpgp/src/keyhandle.rs +++ b/openpgp/src/keyhandle.rs @@ -38,6 +38,7 @@ use crate::{ /// # fn main() -> sequoia_openpgp::Result<()> { /// # use sequoia_openpgp as openpgp; /// use openpgp::KeyHandle; +/// use openpgp::KeyID; /// use openpgp::Packet; /// use openpgp::parse::Parse; /// @@ -59,12 +60,10 @@ use crate::{ /// if let Packet::Signature(sig) = p { /// let issuers = sig.get_issuers(); /// assert_eq!(issuers.len(), 2); -/// assert_eq!(&issuers[0], -/// &KeyHandle::Fingerprint( -/// "C03F A641 1B03 AE12 5764 6118 7223 B566 78E0 2528" -/// .parse()?)); -/// assert_eq!(&issuers[1], -/// &KeyHandle::KeyID("7223 B566 78E0 2528".parse()?)); +/// let kh: KeyHandle +/// = "C03F A641 1B03 AE12 5764 6118 7223 B566 78E0 2528".parse()?; +/// assert!(&issuers[0].aliases(&kh)); +/// assert!(&issuers[1].aliases(&kh)); /// } else { /// unreachable!("It's a signature!"); /// } |