diff options
author | Justus Winter <justus@sequoia-pgp.org> | 2020-05-13 13:46:41 +0200 |
---|---|---|
committer | Justus Winter <justus@sequoia-pgp.org> | 2020-05-13 16:04:03 +0200 |
commit | 3928cd36f63869fc37c78d991d38d13badcb4e80 (patch) | |
tree | cc1d543ec948fa48a79c9c99ed570f19364bd45b /openpgp/src | |
parent | ed092e1bf26f7473c058b0c4524348538d649d2f (diff) |
openpgp: Unawkwardify Encryptor::add_password.
Diffstat (limited to 'openpgp/src')
-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 e2ee0f34..ff25d3b3 100644 --- a/openpgp/src/serialize/stream.rs +++ b/openpgp/src/serialize/stream.rs @@ -2343,15 +2343,20 @@ impl<'a> Encryptor<'a> { /// let message = Message::new(&mut sink); /// let message = /// Encryptor::for_recipients(message, recipients) - /// .add_password("совершенно секретно".into()) + /// .add_passwords(Some("совершенно секретно")) /// .build()?; /// let mut message = LiteralWriter::new(message).build()?; /// message.write_all(b"Hello world.")?; /// message.finalize()?; /// # Ok(()) } /// ``` - pub fn add_password(mut self, password: Password) -> Self { - self.passwords.push(password); + pub fn add_passwords<P>(mut self, passwords: P) -> Self + where P: IntoIterator, + P::Item: Into<Password>, + { + for p in passwords { + self.passwords.push(p.into()); + } self } |