diff options
author | Justus Winter <justus@sequoia-pgp.org> | 2019-05-10 15:10:16 +0200 |
---|---|---|
committer | Justus Winter <justus@sequoia-pgp.org> | 2019-05-10 16:09:19 +0200 |
commit | 72373fd21037b492118148eb5cc580f128dde701 (patch) | |
tree | edba010c2db8efd2da99f91daec128c0f9d2928e /openpgp | |
parent | 750e08657b944a8feb404b55a8d55e9621334e09 (diff) |
openpgp: Add constructor for NotationData.
Diffstat (limited to 'openpgp')
-rw-r--r-- | openpgp/src/packet/signature/subpacket.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/openpgp/src/packet/signature/subpacket.rs b/openpgp/src/packet/signature/subpacket.rs index 85d17706..e8b7a307 100644 --- a/openpgp/src/packet/signature/subpacket.rs +++ b/openpgp/src/packet/signature/subpacket.rs @@ -587,6 +587,17 @@ pub struct NotationData<'a> { } impl<'a> NotationData<'a> { + /// Creates a new Notation Data subpacket payload. + pub fn new<F>(name: &'a str, value: &'a [u8], flags: F) -> Self + where F: Into<Option<NotationDataFlags>> + { + Self { + flags: flags.into().unwrap_or_default(), + name: name.as_bytes(), + value, + } + } + /// Returns the flags. pub fn flags(&self) -> NotationDataFlags { self.flags |