diff options
author | Justus Winter <justus@sequoia-pgp.org> | 2020-02-17 15:25:08 +0100 |
---|---|---|
committer | Justus Winter <justus@sequoia-pgp.org> | 2020-02-17 15:25:08 +0100 |
commit | 997344f0df9abb5e482f173909ebfab42b87b6ec (patch) | |
tree | 7840f7d2cac33bdcf5b16ed161e350d9b6b54165 /openpgp/src/serialize/stream.rs | |
parent | 7dfe2d273a8386952ffea169aa600f05c6d34cb7 (diff) |
openpgp: Make Recipient::new polymorphic over key variants.
Diffstat (limited to 'openpgp/src/serialize/stream.rs')
-rw-r--r-- | openpgp/src/serialize/stream.rs | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/openpgp/src/serialize/stream.rs b/openpgp/src/serialize/stream.rs index 961298b9..7e30dc88 100644 --- a/openpgp/src/serialize/stream.rs +++ b/openpgp/src/serialize/stream.rs @@ -915,9 +915,14 @@ impl<'a> From<&'a Key<PublicParts, UnspecifiedRole>> for Recipient<'a> { impl<'a> Recipient<'a> { /// Creates a new recipient with an explicit recipient keyid. - pub fn new(keyid: KeyID, key: &'a Key<PublicParts, UnspecifiedRole>) - -> Recipient<'a> { - Recipient { keyid, key } + pub fn new<P, R>(keyid: KeyID, key: &'a Key<P, R>) -> Recipient<'a> + where P: key::KeyParts, + R: key::KeyRole, + { + Recipient { + keyid, + key: key.mark_parts_public_ref().mark_role_unspecified_ref(), + } } /// Gets the KeyID. |